@@ -102,8 +102,11 @@ describe(`Test plugin manifest options`, () => {
102
102
theme_color : `#a2466c` ,
103
103
display : `standalone` ,
104
104
} )
105
- const [ filePath , contents ] = fs . writeFileSync . mock . calls [ 0 ]
106
- expect ( filePath ) . toEqual ( path . join ( `public` , `manifest.webmanifest` ) )
105
+ const contents = fs . writeFileSync . mock . calls [ 0 ] [ 1 ]
106
+ expect ( fs . writeFileSync ) . toHaveBeenCalledWith (
107
+ path . join ( `public` , `manifest.webmanifest` ) ,
108
+ expect . anything ( )
109
+ )
107
110
expect ( sharp ) . toHaveBeenCalledTimes ( 0 )
108
111
expect ( contents ) . toMatchSnapshot ( )
109
112
} )
@@ -142,9 +145,8 @@ describe(`Test plugin manifest options`, () => {
142
145
path . dirname ( `other-icons/icon-48x48.png` )
143
146
)
144
147
145
- const calls = fs . mkdirSync . mock . calls
146
- expect ( calls [ 0 ] [ 0 ] ) . toEqual ( firstIconPath )
147
- expect ( calls [ 1 ] [ 0 ] ) . toEqual ( secondIconPath )
148
+ expect ( fs . mkdirSync ) . toHaveBeenNthCalledWith ( 1 , firstIconPath )
149
+ expect ( fs . mkdirSync ) . toHaveBeenNthCalledWith ( 2 , secondIconPath )
148
150
} )
149
151
150
152
it ( `invokes sharp if icon argument specified` , async ( ) => {
@@ -208,8 +210,10 @@ describe(`Test plugin manifest options`, () => {
208
210
} )
209
211
210
212
expect ( sharp ) . toHaveBeenCalledTimes ( 0 )
211
- const content = JSON . parse ( fs . writeFileSync . mock . calls [ 0 ] [ 1 ] )
212
- expect ( content ) . toEqual ( manifestOptions )
213
+ expect ( fs . writeFileSync ) . toHaveBeenCalledWith (
214
+ expect . anything ( ) ,
215
+ JSON . stringify ( manifestOptions )
216
+ )
213
217
} )
214
218
215
219
it ( `does file name based cache busting` , async ( ) => {
@@ -226,8 +230,10 @@ describe(`Test plugin manifest options`, () => {
226
230
} )
227
231
228
232
expect ( sharp ) . toHaveBeenCalledTimes ( 3 )
229
- const content = JSON . parse ( fs . writeFileSync . mock . calls [ 0 ] [ 1 ] )
230
- expect ( content ) . toEqual ( manifestOptions )
233
+ expect ( fs . writeFileSync ) . toHaveBeenCalledWith (
234
+ expect . anything ( ) ,
235
+ JSON . stringify ( manifestOptions )
236
+ )
231
237
} )
232
238
233
239
it ( `does not do cache cache busting` , async ( ) => {
@@ -244,8 +250,10 @@ describe(`Test plugin manifest options`, () => {
244
250
} )
245
251
246
252
expect ( sharp ) . toHaveBeenCalledTimes ( 3 )
247
- const content = JSON . parse ( fs . writeFileSync . mock . calls [ 0 ] [ 1 ] )
248
- expect ( content ) . toEqual ( manifestOptions )
253
+ expect ( fs . writeFileSync ) . toHaveBeenCalledWith (
254
+ expect . anything ( ) ,
255
+ JSON . stringify ( manifestOptions )
256
+ )
249
257
} )
250
258
251
259
it ( `icon options iterator adds options and the icon array take precedence` , async ( ) => {
0 commit comments