-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerator.test.ts
102 lines (86 loc) · 2.49 KB
/
generator.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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
import { describe, expect, it } from "vitest"
import { getBiomeRules } from "./biome"
import { buildConfig } from "./generator"
describe("createConfig", () => {
it("generates a base configuration", async () => {
const config = await buildConfig({})
expect(config).toMatchSnapshot()
})
//
// ENABLING...
//
it("includes NodeJS specific rules", async () => {
const config = await buildConfig({ node: true })
expect(config).toMatchSnapshot()
})
it("includes React specific rules", async () => {
const config = await buildConfig({ react: true })
expect(config).toMatchSnapshot()
})
//
// GLOBAL SETTINGS...
//
it("enables strict rules", async () => {
const config = await buildConfig({ strict: true })
expect(config).toMatchSnapshot()
})
it("applies stylistic rules", async () => {
const config = await buildConfig({ style: true })
expect(config).toMatchSnapshot()
})
it("disable biome supported rules", async () => {
const biomeRules = await getBiomeRules()
const config = await buildConfig({ biome: true }, { biomeRules })
expect(config).toMatchSnapshot()
})
it("disable biome supported and type requiring rules", async () => {
const biomeRules = await getBiomeRules()
const config = await buildConfig(
{ biome: true, fast: true },
{ biomeRules }
)
expect(config).toMatchSnapshot()
})
it("disable type requiring rules", async () => {
const config = await buildConfig({ fast: true })
expect(config).toMatchSnapshot()
})
it("only return disabled rules", async () => {
const config = await buildConfig({ disabled: true })
expect(config).toMatchSnapshot()
})
it("only return disabled (with biome) rules", async () => {
const biomeRules = await getBiomeRules()
const config = await buildConfig(
{ disabled: true, biome: true },
{ biomeRules }
)
expect(config).toMatchSnapshot()
})
//
// COMBINE...
//
it("combines all options", async () => {
const config = await buildConfig({
node: true,
react: true,
strict: true,
style: true
})
expect(config).toMatchSnapshot()
})
it("combines all options without biome support rules", async () => {
const biomeRules = await getBiomeRules()
const config = await buildConfig(
{
node: true,
react: true,
strict: true,
style: true,
biome: true
},
{ biomeRules }
)
expect(config).toMatchSnapshot()
})
})