/
work.test.ts
61 lines (56 loc) · 1.16 KB
/
work.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
60
61
/* eslint-disable */
/**
* @file Provided to help with local test debugging.
*/
import dedent from "dedent";
import type { ValidTestCase, InvalidTestCase } from "../helpers/util";
import { testUsing } from "~/tests/helpers/testers";
/*
* Step 1.
* Import the rule to test.
*/
import { name, rule } from "~/rules/prefer-readonly-type";
/*
* Step 2a.
* Provide a valid test case.
*/
const valid: ReadonlyArray<ValidTestCase> = [
// {
// code: dedent`
// // Valid Code.
// `,
// optionsSet: [[]],
// }
];
/*
* Step 2b.
* Or provide an invalid test case.
*/
const invalid: ReadonlyArray<InvalidTestCase> = [
// {
// code: dedent`
// // Invalid Code.
// `,
// optionsSet: [[]],
// output: dedent`
// // Fixed Code - Remove if rule doesn't have a fixer.
// `,
// errors: [
// {
// messageId: "generic",
// type: "ClassDeclaration",
// line: 2,
// column: 8
// }
// ]
// }
];
/*
* Step 3.
* Run test with `yarn test-work` or to debug in vscode, press F5 (with this
* file open and focused).
*/
testUsing.typescript(name, rule, {
valid: valid,
invalid: invalid,
});