Skip to content

Commit 8bba541

Browse files
authored
test(prefer-comparison-matcher): update names and remove duplicates (#1540)
* test(prefer-comparison-matcher): update test names * test(prefer-comparison-matcher): deduplicate examples
1 parent fb800db commit 8bba541

File tree

1 file changed

+25
-25
lines changed

1 file changed

+25
-25
lines changed

src/rules/__tests__/prefer-comparison-matcher.test.ts

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -205,38 +205,38 @@ const generateValidStringLiteralCases = (operator: string, matcher: string) => {
205205
['x', "'y'"],
206206
['x', '`y`'],
207207
['x', '`y${z}`'],
208-
].reduce((cases, [a, b]) => [
209-
...cases,
210-
...[
211-
`expect(${a} ${operator} ${b}).${matcher}(true)`,
212-
`expect(${a} ${operator} ${b}).${matcher}(false)`,
213-
`expect(${a} ${operator} ${b}).not.${matcher}(true)`,
214-
`expect(${a} ${operator} ${b}).not.${matcher}(false)`,
215-
`expect(${b} ${operator} ${a}).${matcher}(true)`,
216-
`expect(${b} ${operator} ${a}).${matcher}(false)`,
217-
`expect(${b} ${operator} ${a}).not.${matcher}(true)`,
218-
`expect(${b} ${operator} ${a}).not.${matcher}(false)`,
219-
`expect(${a} ${operator} ${b}).${matcher}(true)`,
220-
`expect(${a} ${operator} ${b}).${matcher}(false)`,
221-
`expect(${a} ${operator} ${b}).not.${matcher}(true)`,
222-
`expect(${a} ${operator} ${b}).not.${matcher}(false)`,
223-
`expect(${b} ${operator} ${a}).${matcher}(true)`,
224-
`expect(${b} ${operator} ${a}).${matcher}(false)`,
225-
`expect(${b} ${operator} ${a}).not.${matcher}(true)`,
226-
`expect(${b} ${operator} ${a}).not.${matcher}(false)`,
227-
`expect(${b} ${operator} ${b}).not.${matcher}(false)`,
228-
`expect(${b} ${operator} ${b}).resolves.not.${matcher}(false)`,
229-
`expect(${b} ${operator} ${b}).resolves.${matcher}(false)`,
208+
].reduce(
209+
(cases, [a, b]) => [
210+
...cases,
211+
...[
212+
`expect(${a} ${operator} ${b}).${matcher}(true)`,
213+
`expect(${a} ${operator} ${b}).${matcher}(false)`,
214+
`expect(${a} ${operator} ${b}).not.${matcher}(true)`,
215+
`expect(${a} ${operator} ${b}).not.${matcher}(false)`,
216+
`expect(${a} ${operator} ${b}).resolves.${matcher}(true)`,
217+
`expect(${a} ${operator} ${b}).resolves.${matcher}(false)`,
218+
`expect(${a} ${operator} ${b}).resolves.not.${matcher}(true)`,
219+
`expect(${a} ${operator} ${b}).resolves.not.${matcher}(false)`,
220+
`expect(${b} ${operator} ${a}).resolves.not.${matcher}(false)`,
221+
`expect(${b} ${operator} ${a}).resolves.not.${matcher}(true)`,
222+
`expect(${b} ${operator} ${a}).resolves.${matcher}(false)`,
223+
`expect(${b} ${operator} ${a}).resolves.${matcher}(true)`,
224+
`expect(${b} ${operator} ${a}).not.${matcher}(false)`,
225+
`expect(${b} ${operator} ${a}).not.${matcher}(true)`,
226+
`expect(${b} ${operator} ${a}).${matcher}(false)`,
227+
`expect(${b} ${operator} ${a}).${matcher}(true)`,
228+
],
230229
],
231-
]);
230+
[],
231+
);
232232
};
233233

234234
const testComparisonOperator = (
235235
operator: string,
236236
preferredMatcher: string,
237237
preferredMatcherWhenNegated: string,
238238
) => {
239-
ruleTester.run(`prefer-to-be-comparison: ${operator}`, rule, {
239+
ruleTester.run(`prefer-comparison-matcher: ${operator}`, rule, {
240240
valid: [
241241
'expect()',
242242
'expect({}).toStrictEqual({})',
@@ -274,7 +274,7 @@ testComparisonOperator('<', 'toBeLessThan', 'toBeGreaterThanOrEqual');
274274
testComparisonOperator('>=', 'toBeGreaterThanOrEqual', 'toBeLessThan');
275275
testComparisonOperator('<=', 'toBeLessThanOrEqual', 'toBeGreaterThan');
276276

277-
ruleTester.run(`prefer-to-be-comparison`, rule, {
277+
ruleTester.run(`prefer-comparison-matcher`, rule, {
278278
valid: [
279279
'expect.hasAssertions',
280280
'expect.hasAssertions()',

0 commit comments

Comments
 (0)