@@ -8,6 +8,7 @@ const { identifyCssModule, bundleCssModule } = require('../lib/util.js');
8
8
const Writer = require ( '..' ) ;
9
9
10
10
test ( 'identifyCssModule(filePath)' , async ( ) => {
11
+ expect . assertions ( 1 ) ;
11
12
const filePath = path . join ( __dirname , 'test-assets/my-module-1/main.css' ) ;
12
13
const fileRef = 'my-module-1/main.css' ;
13
14
@@ -23,6 +24,7 @@ test('identifyCssModule(filePath)', async () => {
23
24
} ) ;
24
25
25
26
test ( 'identifyCssModule(filePath) css in nested directory' , async ( ) => {
27
+ expect . assertions ( 1 ) ;
26
28
const filePath = path . join ( __dirname , 'test-assets/my-module-2/css/main.css' ) ;
27
29
const fileRef = 'my-module-2/css/main.css' ;
28
30
@@ -38,6 +40,7 @@ test('identifyCssModule(filePath) css in nested directory', async () => {
38
40
} ) ;
39
41
40
42
test ( 'bundleCssModule(filePath)' , async ( ) => {
43
+ expect . assertions ( 3 ) ;
41
44
const filePath = path . join ( __dirname , 'test-assets/my-module-3/css/main.css' ) ;
42
45
43
46
const result = await bundleCssModule ( filePath ) ;
@@ -47,7 +50,8 @@ test('bundleCssModule(filePath)', async () => {
47
50
expect ( result ) . toMatch ( 'dep/main.css' ) ;
48
51
} ) ;
49
52
50
- test ( 'new Writer(filePath)' , ( ) => {
53
+ test ( 'new Writer(filePath)' , done => {
54
+ expect . assertions ( 2 ) ;
51
55
const filePath = path . join ( __dirname , 'test-assets/my-module-1/main.css' ) ;
52
56
const fileRef = 'my-module-1/main.css' ;
53
57
@@ -63,18 +67,21 @@ test('new Writer(filePath)', () => {
63
67
const result2 = items [ 1 ] ;
64
68
expect ( result1 . id ) . toBe ( hasher ( `my-module-1|1.0.1|${ fileRef } ` ) ) ;
65
69
expect ( result2 ) . toBeFalsy ( ) ;
70
+ done ( ) ;
66
71
} ) ;
67
72
} ) ;
68
73
69
74
test ( 'new Writer(filePath) relative paths throw error' , ( ) => {
75
+ expect . assertions ( 1 ) ;
70
76
const filePath = './test-assets/my-module-1/main.css' ;
71
77
72
78
const result = ( ) => new Writer ( filePath ) ;
73
79
74
80
expect ( result ) . toThrow ( ) ;
75
81
} ) ;
76
82
77
- test ( 'new Writer([filePath])' , ( ) => {
83
+ test ( 'new Writer([filePath])' , done => {
84
+ expect . assertions ( 2 ) ;
78
85
const filePath = path . join ( __dirname , 'test-assets/my-module-1/main.css' ) ;
79
86
const fileRef = 'my-module-1/main.css' ;
80
87
@@ -90,10 +97,12 @@ test('new Writer([filePath])', () => {
90
97
const result2 = items [ 1 ] ;
91
98
expect ( result1 . id ) . toBe ( hasher ( `my-module-1|1.0.1|${ fileRef } ` ) ) ;
92
99
expect ( result2 ) . toBeFalsy ( ) ;
100
+ done ( ) ;
93
101
} ) ;
94
102
} ) ;
95
103
96
- test ( 'Writer processes @import statements' , ( ) => {
104
+ test ( 'Writer processes @import statements' , done => {
105
+ expect . assertions ( 5 ) ;
97
106
const filePath = path . join ( __dirname , 'test-assets/my-module-3/css/main.css' ) ;
98
107
const fileRef = 'my-module-3/css/main.css' ;
99
108
@@ -113,10 +122,12 @@ test('Writer processes @import statements', () => {
113
122
expect ( result1 . content ) . toMatch ( 'my-module-3/dep.css' ) ;
114
123
expect ( result1 . content ) . toMatch ( 'dep/main.css' ) ;
115
124
expect ( result2 ) . toBeFalsy ( ) ;
125
+ done ( ) ;
116
126
} ) ;
117
127
} ) ;
118
128
119
- test ( 'new Writer([filePath1, filePath2]) ensures correct order' , ( ) => {
129
+ test ( 'new Writer([filePath1, filePath2]) ensures correct order' , done => {
130
+ expect . assertions ( 3 ) ;
120
131
const filePath1 = path . join ( __dirname , 'test-assets/my-module-1/main.css' ) ;
121
132
const fileRef1 = 'my-module-1/main.css' ;
122
133
const filePath2 = path . join ( __dirname , 'test-assets/my-module-2/css/main.css' ) ;
@@ -137,10 +148,12 @@ test('new Writer([filePath1, filePath2]) ensures correct order', () => {
137
148
expect ( result1 . id ) . toBe ( hasher ( `my-module-1|1.0.1|${ fileRef1 } ` ) ) ;
138
149
expect ( result2 . id ) . toBe ( hasher ( `my-module-2|1.0.1|${ fileRef2 } ` ) ) ;
139
150
expect ( result3 ) . toBeFalsy ( ) ;
151
+ done ( ) ;
140
152
} ) ;
141
153
} ) ;
142
154
143
155
test ( 'new Writer([filePath]) ensures filePath[] is not null' , ( ) => {
156
+ expect . assertions ( 1 ) ;
144
157
const filePath = null ;
145
158
146
159
const result = ( ) => new Writer ( filePath ) ;
@@ -149,6 +162,7 @@ test('new Writer([filePath]) ensures filePath[] is not null', () => {
149
162
} ) ;
150
163
151
164
test ( 'new Writer([filePath]) ensures filePath[] is not a number' , ( ) => {
165
+ expect . assertions ( 1 ) ;
152
166
const filePath = 2 ;
153
167
154
168
const result = ( ) => new Writer ( filePath ) ;
@@ -157,6 +171,7 @@ test('new Writer([filePath]) ensures filePath[] is not a number', () => {
157
171
} ) ;
158
172
159
173
test ( 'new Writer([filePath]) ensures filePath is not an object' , ( ) => {
174
+ expect . assertions ( 1 ) ;
160
175
const filePath = { } ;
161
176
162
177
const result = ( ) => new Writer ( filePath ) ;
@@ -165,6 +180,7 @@ test('new Writer([filePath]) ensures filePath is not an object', () => {
165
180
} ) ;
166
181
167
182
test ( 'new Writer([filePath]) ensures filePath[] is an array of strings' , ( ) => {
183
+ expect . assertions ( 1 ) ;
168
184
const filePath = null ;
169
185
170
186
const result = ( ) => new Writer ( [ filePath ] ) ;
@@ -173,6 +189,7 @@ test('new Writer([filePath]) ensures filePath[] is an array of strings', () => {
173
189
} ) ;
174
190
175
191
test ( 'new Writer([filePath]) ensures valid filePath provided' , ( ) => {
192
+ expect . assertions ( 1 ) ;
176
193
const filePath = 'fake.css' ;
177
194
178
195
const result = ( ) => new Writer ( filePath ) ;
@@ -181,6 +198,7 @@ test('new Writer([filePath]) ensures valid filePath provided', () => {
181
198
} ) ;
182
199
183
200
test ( 'new Writer([filePath]) ensures valid filePaths provided in array' , ( ) => {
201
+ expect . assertions ( 1 ) ;
184
202
const filePath = 'fake.css' ;
185
203
186
204
const result = ( ) => new Writer ( [ filePath ] ) ;
0 commit comments