-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmain.test.ts
More file actions
129 lines (111 loc) · 3.64 KB
/
main.test.ts
File metadata and controls
129 lines (111 loc) · 3.64 KB
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
import { expect, test } from 'vitest'
import { handler } from '../src/commands/build'
import { readFileSync } from "node:fs"
test('contains 1 class if there is one CSS Module', async () => {
await handler({
source: "fixtures/oneCssModule",
outFile: 'fixtures/oneCssModule/CssModules.fs',
internal: true,
camelCase: false,
_: [],
$0: ''
})
const content = readFileSync("fixtures/oneCssModule/CssModules.fs").toString()
expect(content).toMatchSnapshot()
})
test('contains 1 class per CSS Module', async () => {
await handler({
source: "fixtures/multipleCssModules",
outFile: 'fixtures/multipleCssModules/CssModules.fs',
internal: true,
camelCase: false,
_: [],
$0: ''
})
const content = readFileSync("fixtures/multipleCssModules/CssModules.fs").toString()
expect(content).toMatchSnapshot()
})
test('support CSS/SASS/SCSS modules', async () => {
await handler({
source: "fixtures/checkSupportedFormat",
outFile: 'fixtures/checkSupportedFormat/CssModules.fs',
internal: true,
camelCase: false,
_: [],
$0: ''
})
const content = readFileSync("fixtures/checkSupportedFormat/CssModules.fs").toString()
expect(content).toMatchSnapshot()
})
test('if internal is set to false module should not be marked as internal ', async () => {
await handler({
source: "fixtures/notInternalModule",
outFile: 'fixtures/notInternalModule/CssModules.fs',
internal: false,
camelCase: false,
_: [],
$0: ''
})
const content = readFileSync("fixtures/notInternalModule/CssModules.fs").toString()
expect(content).toMatchSnapshot()
})
test('module name with a dot should be transformed to a valid F# identifier', async () => {
await handler({
source: "fixtures/moduleWithDot",
outFile: 'fixtures/moduleWithDot/CssModules.fs',
internal: true,
camelCase: false,
_: [],
$0: ''
})
const content = readFileSync("fixtures/moduleWithDot/CssModules.fs").toString()
expect(content).toMatchSnapshot()
})
test('nested folder is supported', async () => {
await handler({
source: "fixtures/nestedFolder",
outFile: 'fixtures/nestedFolder/CssModules.fs',
internal: true,
camelCase: false,
_: [],
$0: ''
})
const content = readFileSync("fixtures/nestedFolder/CssModules.fs").toString()
expect(content).toMatchSnapshot()
})
test("nested CSS is supported", async () => {
await handler({
source: "fixtures/nestedCss",
outFile: 'fixtures/nestedCss/CssModules.fs',
internal: true,
camelCase: false,
_: [],
$0: ''
})
const content = readFileSync("fixtures/nestedCss/CssModules.fs").toString()
expect(content).toMatchSnapshot()
})
test("sanitize class name", async () => {
await handler({
source: "fixtures/sanitizeClasses",
outFile: 'fixtures/sanitizeClasses/CssModules.fs',
internal: true,
camelCase: false,
_: [],
$0: ''
})
const content = readFileSync("fixtures/sanitizeClasses/CssModules.fs").toString()
expect(content).toMatchSnapshot()
})
test("transformToCamelCase class name", async () => {
await handler({
source: "fixtures/transformToCamelCase",
outFile: 'fixtures/transformToCamelCase/CssModules.fs',
internal: true,
camelCase: true,
_: [],
$0: ''
})
const content = readFileSync("fixtures/transformToCamelCase/CssModules.fs").toString()
expect(content).toMatchSnapshot()
})