@@ -8,7 +8,7 @@ import {Region} from "./region.class";
8
8
import { ScreenClass } from "./screen.class" ;
9
9
import { mockPartial } from "sneer" ;
10
10
import { ProviderRegistry } from "./provider/provider-registry.class" ;
11
- import { ImageFinderInterface , ImageWriter , ScreenProviderInterface } from "./provider" ;
11
+ import { ImageFinderInterface , ImageWriter , ImageWriterParameters , ScreenProviderInterface } from "./provider" ;
12
12
13
13
jest . mock ( 'jimp' , ( ) => {
14
14
} ) ;
@@ -627,14 +627,15 @@ describe("Screen.", () => {
627
627
const SUT = new ScreenClass ( providerRegistryMock ) ;
628
628
const imageName = "foobar.png"
629
629
const expectedImagePath = join ( cwd ( ) , imageName )
630
+ const expectedData : ImageWriterParameters = { image : screenshot , path : expectedImagePath }
630
631
631
632
// WHEN
632
633
const imagePath = await SUT . capture ( imageName )
633
634
634
635
// THEN
635
636
expect ( imagePath ) . toBe ( expectedImagePath )
636
637
expect ( grabScreenMock ) . toHaveBeenCalled ( )
637
- expect ( saveImageMock ) . toHaveBeenCalledWith ( { data : screenshot , path : expectedImagePath } )
638
+ expect ( saveImageMock ) . toHaveBeenCalledWith ( expectedData ) ;
638
639
} ) ;
639
640
} )
640
641
@@ -655,14 +656,15 @@ describe("Screen.", () => {
655
656
const SUT = new ScreenClass ( providerRegistryMock ) ;
656
657
const imageName = "foobar.png"
657
658
const expectedImagePath = join ( cwd ( ) , imageName )
659
+ const expectedData : ImageWriterParameters = { image : screenshot , path : expectedImagePath }
658
660
659
661
// WHEN
660
662
const imagePath = await SUT . captureRegion ( imageName , regionToCapture )
661
663
662
664
// THEN
663
665
expect ( imagePath ) . toBe ( expectedImagePath )
664
666
expect ( grabScreenMock ) . toHaveBeenCalledWith ( regionToCapture )
665
- expect ( saveImageMock ) . toHaveBeenCalledWith ( { data : screenshot , path : expectedImagePath } )
667
+ expect ( saveImageMock ) . toHaveBeenCalledWith ( expectedData ) ;
666
668
} ) ;
667
669
} ) ;
668
670
} ) ;
0 commit comments