@@ -29,7 +29,10 @@ test('identifyCssModule(filePath)', async () => {
29
29
30
30
test ( 'identifyCssModule(filePath) css in nested directory' , async ( ) => {
31
31
expect . assertions ( 1 ) ;
32
- const filePath = path . join ( __dirname , 'test-assets/my-module-2/css/main.css' ) ;
32
+ const filePath = path . join (
33
+ __dirname ,
34
+ 'test-assets/my-module-2/css/main.css'
35
+ ) ;
33
36
const fileRef = 'my-module-2/css/main.css' ;
34
37
35
38
const result = await identifyCssModule ( filePath ) ;
@@ -44,7 +47,10 @@ test('identifyCssModule(filePath) css in nested directory', async () => {
44
47
45
48
test ( 'bundleCssModule(filePath)' , async ( ) => {
46
49
expect . assertions ( 3 ) ;
47
- const filePath = path . join ( __dirname , 'test-assets/my-module-3/css/main.css' ) ;
50
+ const filePath = path . join (
51
+ __dirname ,
52
+ 'test-assets/my-module-3/css/main.css'
53
+ ) ;
48
54
49
55
const result = await bundleCssModule ( filePath ) ;
50
56
@@ -68,7 +74,9 @@ test('new Writer(filePath)', done => {
68
74
writer . on ( 'end' , ( ) => {
69
75
const result1 = items [ 0 ] ;
70
76
const result2 = items [ 1 ] ;
71
- expect ( result1 . id ) . toBe ( hasher ( `my-module-1|1.0.1|${ fileRef } |${ result1 . content } ` ) ) ;
77
+ expect ( result1 . id ) . toBe (
78
+ hasher ( `my-module-1|1.0.1|${ fileRef } |${ result1 . content } ` )
79
+ ) ;
72
80
expect ( result2 ) . toBeFalsy ( ) ;
73
81
done ( ) ;
74
82
} ) ;
@@ -98,15 +106,20 @@ test('new Writer([filePath])', done => {
98
106
writer . on ( 'end' , ( ) => {
99
107
const result1 = items [ 0 ] ;
100
108
const result2 = items [ 1 ] ;
101
- expect ( result1 . id ) . toBe ( hasher ( `my-module-1|1.0.1|${ fileRef } |${ result1 . content } ` ) ) ;
109
+ expect ( result1 . id ) . toBe (
110
+ hasher ( `my-module-1|1.0.1|${ fileRef } |${ result1 . content } ` )
111
+ ) ;
102
112
expect ( result2 ) . toBeFalsy ( ) ;
103
113
done ( ) ;
104
114
} ) ;
105
115
} ) ;
106
116
107
117
test ( 'Writer processes @import statements' , done => {
108
118
expect . assertions ( 5 ) ;
109
- const filePath = path . join ( __dirname , 'test-assets/my-module-3/css/main.css' ) ;
119
+ const filePath = path . join (
120
+ __dirname ,
121
+ 'test-assets/my-module-3/css/main.css'
122
+ ) ;
110
123
const fileRef = 'my-module-3/css/main.css' ;
111
124
112
125
const writer = new Writer ( [ filePath ] ) ;
@@ -120,7 +133,9 @@ test('Writer processes @import statements', done => {
120
133
const result1 = items [ 0 ] ;
121
134
const result2 = items [ 1 ] ;
122
135
123
- expect ( result1 . id ) . toBe ( hasher ( `my-module-3|1.0.1|${ fileRef } |${ result1 . content } ` ) ) ;
136
+ expect ( result1 . id ) . toBe (
137
+ hasher ( `my-module-3|1.0.1|${ fileRef } |${ result1 . content } ` )
138
+ ) ;
124
139
expect ( result1 . content ) . toMatch ( 'my-module-3/main.css' ) ;
125
140
expect ( result1 . content ) . toMatch ( 'my-module-3/dep.css' ) ;
126
141
expect ( result1 . content ) . toMatch ( 'dep/main.css' ) ;
@@ -133,7 +148,10 @@ test('new Writer([filePath1, filePath2]) ensures correct order', done => {
133
148
expect . assertions ( 3 ) ;
134
149
const filePath1 = path . join ( __dirname , 'test-assets/my-module-1/main.css' ) ;
135
150
const fileRef1 = 'my-module-1/main.css' ;
136
- const filePath2 = path . join ( __dirname , 'test-assets/my-module-2/css/main.css' ) ;
151
+ const filePath2 = path . join (
152
+ __dirname ,
153
+ 'test-assets/my-module-2/css/main.css'
154
+ ) ;
137
155
const fileRef2 = 'my-module-2/css/main.css' ;
138
156
139
157
const writer = new Writer ( [ filePath1 , filePath2 ] ) ;
@@ -148,8 +166,12 @@ test('new Writer([filePath1, filePath2]) ensures correct order', done => {
148
166
const result2 = items [ 1 ] ;
149
167
const result3 = items [ 2 ] ;
150
168
151
- expect ( result1 . id ) . toBe ( hasher ( `my-module-1|1.0.1|${ fileRef1 } |${ result1 . content } ` ) ) ;
152
- expect ( result2 . id ) . toBe ( hasher ( `my-module-2|1.0.1|${ fileRef2 } |${ result2 . content } ` ) ) ;
169
+ expect ( result1 . id ) . toBe (
170
+ hasher ( `my-module-1|1.0.1|${ fileRef1 } |${ result1 . content } ` )
171
+ ) ;
172
+ expect ( result2 . id ) . toBe (
173
+ hasher ( `my-module-2|1.0.1|${ fileRef2 } |${ result2 . content } ` )
174
+ ) ;
153
175
expect ( result3 ) . toBeFalsy ( ) ;
154
176
done ( ) ;
155
177
} ) ;
@@ -212,10 +234,10 @@ test('new Writer([filePath]) ensures valid filePaths provided in array', () => {
212
234
test ( 'writer emits error' , done => {
213
235
expect . assertions ( 1 ) ;
214
236
jest . mock ( '../lib/util.js' , ( ) => ( {
215
- bundleCssModule ( ) {
237
+ bundleCssModule ( ) {
216
238
throw new Error ( ) ;
217
239
} ,
218
- identifyCssModule ( ) {
240
+ identifyCssModule ( ) {
219
241
throw new Error ( ) ;
220
242
} ,
221
243
} ) ) ;
0 commit comments