-
-
Notifications
You must be signed in to change notification settings - Fork 33
/
Copy pathmigration.spec.ts
39 lines (35 loc) · 1.08 KB
/
migration.spec.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
import { RuleTester } from "@typescript-eslint/rule-tester";
import migration from "../../src/migration";
import parser from "@typescript-eslint/parser";
import { version } from "../../package.json";
RuleTester.afterAll = afterAll;
RuleTester.describe = describe;
RuleTester.it = it;
const tester = new RuleTester({
languageOptions: { parser },
});
describe("Migration", () => {
test("should consist of one rule being the major version of the package", () => {
expect(migration.rules).toHaveProperty(`v${version.split(".")[0]}`);
expect(migration).toMatchSnapshot();
});
tester.run("v23", migration.rules.v23, {
valid: [`import { HeaderSecurity } from "express-zod-api";`],
invalid: [
{
code: `const security: CustomHeaderSecurity = {};`,
output: `const security: HeaderSecurity = {};`,
errors: [
{
messageId: "change",
data: {
subject: "interface",
from: "CustomHeaderSecurity",
to: "HeaderSecurity",
},
},
],
},
],
});
});