Skip to content

Commit 00a3849

Browse files
j8kinbruno-morel
authored andcommitted
remove unused function parameters
isOutline is now not necessary
1 parent 839095b commit 00a3849

File tree

1 file changed

+10
-24
lines changed

1 file changed

+10
-24
lines changed

src/index.js

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,7 @@ const Fusion = (featureFileToLoad, optionsToPassToJestCucumber) => {
106106
feature.scenarioOutlines,
107107
beforeEach,
108108
afterEach,
109-
testFn,
110-
true
109+
testFn
111110
);
112111
});
113112
};
@@ -116,8 +115,7 @@ const matchJestTestSuiteWithCucumberFeature = (
116115
featureScenariosOrOutline,
117116
beforeEachFn,
118117
afterEachFn,
119-
testFn,
120-
isOutline
118+
testFn
121119
) => {
122120
featureScenariosOrOutline.forEach((currentScenarioOrOutline) => {
123121
if (stepsDefinition.before) beforeEachFn(stepsDefinition.before);
@@ -141,8 +139,7 @@ const matchJestTestSuiteWithCucumberFeature = (
141139
currentScenarioOrOutline.scenarios != null
142140
? currentScenarioOrOutline.scenarios[0].steps
143141
: currentScenarioOrOutline.steps,
144-
testFn,
145-
isOutline
142+
testFn
146143
);
147144

148145
if (stepsDefinition.after) afterEachFn(stepsDefinition.after);
@@ -152,26 +149,20 @@ const matchJestTestSuiteWithCucumberFeature = (
152149
const matchJestTestWithCucumberScenario = (
153150
currentScenarioTitle,
154151
currentScenarioSteps,
155-
testFn,
156-
isOutline
152+
testFn
157153
) => {
158154
testFn(currentScenarioTitle, ({ given, when, then, and, but }) => {
159155
currentScenarioSteps.forEach((currentStep) => {
160156
matchJestDefinitionWithCucumberStep(
161157
{ given, when, then, and, but },
162-
currentStep,
163-
isOutline
158+
currentStep
164159
);
165160
});
166161
});
167162
};
168163

169-
const matchJestDefinitionWithCucumberStep = (
170-
verbFunction,
171-
currentStep,
172-
isOutline
173-
) => {
174-
const foundMatchingStep = findMatchingStep(currentStep, isOutline);
164+
const matchJestDefinitionWithCucumberStep = (verbFunction, currentStep) => {
165+
const foundMatchingStep = findMatchingStep(currentStep);
175166
if (!foundMatchingStep) return;
176167

177168
// this will be the "given", "when", "then"...functions
@@ -181,15 +172,14 @@ const matchJestDefinitionWithCucumberStep = (
181172
);
182173
};
183174

184-
const findMatchingStep = (currentStep, isOutline) => {
175+
const findMatchingStep = (currentStep) => {
185176
const scenarioType = currentStep.keyword;
186177
const scenarioSentence = currentStep.stepText;
187178
const foundStep = Object.keys(stepsDefinition[scenarioType]).find(
188179
(currentStepDefinitionFunction) => {
189180
return isFunctionForScenario(
190181
scenarioSentence,
191-
stepsDefinition[scenarioType][currentStepDefinitionFunction],
192-
isOutline
182+
stepsDefinition[scenarioType][currentStepDefinitionFunction]
193183
);
194184
}
195185
);
@@ -203,11 +193,7 @@ const findMatchingStep = (currentStep, isOutline) => {
203193
);
204194
};
205195

206-
const isFunctionForScenario = (
207-
scenarioSentence,
208-
stepDefinitionFunction,
209-
isOutline
210-
) =>
196+
const isFunctionForScenario = (scenarioSentence, stepDefinitionFunction) =>
211197
stepDefinitionFunction.stepRegExp
212198
? scenarioSentence.match(stepDefinitionFunction.stepRegExp)
213199
: scenarioSentence === stepDefinitionFunction.stepExpression;

0 commit comments

Comments
 (0)