Skip to content

Commit aaa0fe2

Browse files
committed
(#340) Fixed screen tests
1 parent 5457f96 commit aaa0fe2

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

lib/screen.class.spec.ts

+5-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import {Region} from "./region.class";
88
import {ScreenClass} from "./screen.class";
99
import {mockPartial} from "sneer";
1010
import {ProviderRegistry} from "./provider/provider-registry.class";
11-
import {ImageFinderInterface, ImageWriter, ScreenProviderInterface} from "./provider";
11+
import {ImageFinderInterface, ImageWriter, ImageWriterParameters, ScreenProviderInterface} from "./provider";
1212

1313
jest.mock('jimp', () => {
1414
});
@@ -627,14 +627,15 @@ describe("Screen.", () => {
627627
const SUT = new ScreenClass(providerRegistryMock);
628628
const imageName = "foobar.png"
629629
const expectedImagePath = join(cwd(), imageName)
630+
const expectedData: ImageWriterParameters = {image: screenshot, path: expectedImagePath}
630631

631632
// WHEN
632633
const imagePath = await SUT.capture(imageName)
633634

634635
// THEN
635636
expect(imagePath).toBe(expectedImagePath)
636637
expect(grabScreenMock).toHaveBeenCalled()
637-
expect(saveImageMock).toHaveBeenCalledWith({data: screenshot, path: expectedImagePath})
638+
expect(saveImageMock).toHaveBeenCalledWith(expectedData);
638639
});
639640
})
640641

@@ -655,14 +656,15 @@ describe("Screen.", () => {
655656
const SUT = new ScreenClass(providerRegistryMock);
656657
const imageName = "foobar.png"
657658
const expectedImagePath = join(cwd(), imageName)
659+
const expectedData: ImageWriterParameters = {image: screenshot, path: expectedImagePath}
658660

659661
// WHEN
660662
const imagePath = await SUT.captureRegion(imageName, regionToCapture)
661663

662664
// THEN
663665
expect(imagePath).toBe(expectedImagePath)
664666
expect(grabScreenMock).toHaveBeenCalledWith(regionToCapture)
665-
expect(saveImageMock).toHaveBeenCalledWith({data: screenshot, path: expectedImagePath})
667+
expect(saveImageMock).toHaveBeenCalledWith(expectedData);
666668
});
667669
});
668670
});

0 commit comments

Comments
 (0)