@@ -138,8 +138,6 @@ describe('diff-snapshot', () => {
138
138
diffPixelCount : 0 ,
139
139
pass : true ,
140
140
} ) ;
141
- // Check that pixelmatch was not called
142
- expect ( mockPixelMatch ) . not . toHaveBeenCalled ( ) ;
143
141
} ) ;
144
142
145
143
it ( 'it should not write a diff if a test passes' , ( ) => {
@@ -160,8 +158,6 @@ describe('diff-snapshot', () => {
160
158
diffPixelCount : 0 ,
161
159
pass : true ,
162
160
} ) ;
163
- // Check that pixelmatch was not called
164
- expect ( mockPixelMatch ) . not . toHaveBeenCalled ( ) ;
165
161
166
162
// Check that that it did not attempt to write a diff
167
163
expect ( mockWriteFileSync . mock . calls ) . toEqual ( [ ] ) ;
@@ -348,7 +344,14 @@ describe('diff-snapshot', () => {
348
344
} ) ;
349
345
350
346
// Check that pixelmatch was not called
351
- expect ( mockPixelMatch ) . not . toHaveBeenCalled ( ) ;
347
+ expect ( mockPixelMatch ) . toHaveBeenCalledWith (
348
+ expect . any ( Object ) , // buffer data
349
+ expect . any ( Object ) , // buffer data
350
+ expect . any ( Object ) , // buffer data
351
+ expect . any ( Number ) , // image width
352
+ expect . any ( Number ) , // image height
353
+ { threshold : 0.01 }
354
+ ) ;
352
355
} ) ;
353
356
354
357
it ( 'should merge custom configuration with default configuration if custom config is passed' , ( ) => {
@@ -361,15 +364,21 @@ describe('diff-snapshot', () => {
361
364
diffDir : mockDiffDir ,
362
365
updateSnapshot : false ,
363
366
customDiffConfig : {
364
- threshold : 0.1 ,
365
367
foo : 'bar' ,
366
368
} ,
367
369
failureThreshold : 0 ,
368
370
failureThresholdType : 'pixel' ,
369
371
} ) ;
370
372
371
373
// Check that pixelmatch was not called
372
- expect ( mockPixelMatch ) . not . toHaveBeenCalled ( ) ;
374
+ expect ( mockPixelMatch ) . toHaveBeenCalledWith (
375
+ expect . any ( Object ) , // buffer data
376
+ expect . any ( Object ) , // buffer data
377
+ expect . any ( Object ) , // buffer data
378
+ expect . any ( Number ) , // image width
379
+ expect . any ( Number ) , // image height
380
+ { foo : 'bar' , threshold : 0.01 }
381
+ ) ;
373
382
} ) ;
374
383
375
384
it ( 'should create diff output directory if there is not one already and test is failing' , ( ) => {
0 commit comments