-
Notifications
You must be signed in to change notification settings - Fork 227
/
no-empty-title.test.ts
59 lines (57 loc) · 1.62 KB
/
no-empty-title.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
import { TSESLint } from '@typescript-eslint/experimental-utils';
import rule from '../no-empty-title';
const ruleTester = new TSESLint.RuleTester({
parserOptions: {
sourceType: 'module',
},
});
ruleTester.run('no-empty-title', rule, {
valid: [
'describe()',
'someFn("", function () {})',
'describe(1, function () {})',
'describe("foo", function () {})',
'describe("foo", function () { it("bar", function () {}) })',
'test("foo", function () {})',
'test(`foo`, function () {})',
'test(`${foo}`, function () {})',
"it('foo', function () {})",
"xdescribe('foo', function () {})",
"xit('foo', function () {})",
"xtest('foo', function () {})",
],
invalid: [
{
code: 'describe("", function () {})',
errors: [{ messageId: 'describe', column: 10, line: 1 }],
},
{
code: ["describe('foo', () => {", "it('', () => {})", '})'].join('\n'),
errors: [{ messageId: 'test', column: 4, line: 2 }],
},
{
code: 'it("", function () {})',
errors: [{ messageId: 'test', column: 4, line: 1 }],
},
{
code: 'test("", function () {})',
errors: [{ messageId: 'test', column: 6, line: 1 }],
},
{
code: 'test(``, function () {})',
errors: [{ messageId: 'test', column: 6, line: 1 }],
},
{
code: "xdescribe('', () => {})",
errors: [{ messageId: 'describe', column: 11, line: 1 }],
},
{
code: "xit('', () => {})",
errors: [{ messageId: 'test', column: 5, line: 1 }],
},
{
code: "xtest('', () => {})",
errors: [{ messageId: 'test', column: 7, line: 1 }],
},
],
});