|
1 | 1 | import { TSESLint } from '@typescript-eslint/experimental-utils';
|
| 2 | +import dedent from 'dedent'; |
2 | 3 | import resolveFrom from 'resolve-from';
|
3 | 4 | import rule from '../consistent-test-it';
|
4 | 5 | import { TestCaseName } from '../utils';
|
@@ -172,6 +173,46 @@ ruleTester.run('consistent-test-it with fn=test', rule, {
|
172 | 173 | },
|
173 | 174 | ],
|
174 | 175 | },
|
| 176 | + { |
| 177 | + code: 'describe.each``("foo", () => { test.each``("bar") })', |
| 178 | + output: 'describe.each``("foo", () => { it.each``("bar") })', |
| 179 | + options: [{ fn: TestCaseName.it }], |
| 180 | + errors: [ |
| 181 | + { |
| 182 | + messageId: 'consistentMethodWithinDescribe', |
| 183 | + data: { |
| 184 | + testKeywordWithinDescribe: TestCaseName.it, |
| 185 | + oppositeTestKeyword: TestCaseName.test, |
| 186 | + }, |
| 187 | + }, |
| 188 | + ], |
| 189 | + }, |
| 190 | + { |
| 191 | + code: dedent` |
| 192 | + describe.each()("%s", () => { |
| 193 | + test("is valid, but should not be", () => {}); |
| 194 | +
|
| 195 | + it("is not valid, but should be", () => {}); |
| 196 | + }); |
| 197 | + `, |
| 198 | + output: dedent` |
| 199 | + describe.each()("%s", () => { |
| 200 | + it("is valid, but should not be", () => {}); |
| 201 | +
|
| 202 | + it("is not valid, but should be", () => {}); |
| 203 | + }); |
| 204 | + `, |
| 205 | + options: [{ fn: TestCaseName.test, withinDescribe: TestCaseName.it }], |
| 206 | + errors: [ |
| 207 | + { |
| 208 | + messageId: 'consistentMethodWithinDescribe', |
| 209 | + data: { |
| 210 | + testKeywordWithinDescribe: TestCaseName.it, |
| 211 | + oppositeTestKeyword: TestCaseName.test, |
| 212 | + }, |
| 213 | + }, |
| 214 | + ], |
| 215 | + }, |
175 | 216 | {
|
176 | 217 | code: 'describe("suite", () => { it("foo") })',
|
177 | 218 | output: 'describe("suite", () => { test("foo") })',
|
|
0 commit comments