@amiceli/vitest-cucumber
Version:
vitest tools to use Gherkin feature in unit tests
21 lines (20 loc) • 602 B
JavaScript
import { NotAllowedBackgroundStepTypeError } from '../../errors/errors';
import { StepAble } from './Stepable';
import { StepTypes } from './step';
const BackgroundAllowedSteps = [StepTypes.GIVEN, StepTypes.AND];
export class Background extends StepAble {
constructor(title = 'Background') {
super(title);
}
getTitle() {
return `${this.title}:`;
}
addStep(step) {
if (BackgroundAllowedSteps.includes(step.type)) {
super.addStep(step);
}
else {
throw new NotAllowedBackgroundStepTypeError(step.type);
}
}
}