Skip to content

Commit b994a3d

Browse files
committed
Add test to cover overriding of searchMultipleScales
1 parent c5fe940 commit b994a3d

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

lib/screen.class.spec.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,30 @@ describe("Screen.", () => {
161161
expect(visionAdapterMock.findOnScreenRegion).toHaveBeenCalledWith(expectedMatchRequest);
162162
});
163163

164+
it("should override searchMultipleScales with parameter.", async () => {
165+
// GIVEN
166+
const matchResult = new MatchResult(0.99, searchRegion);
167+
VisionAdapter.prototype.findOnScreenRegion = jest.fn(() => {
168+
return Promise.resolve(matchResult);
169+
});
170+
const visionAdapterMock = new VisionAdapter();
171+
const SUT = new Screen(visionAdapterMock);
172+
const imagePath = "test/path/to/image.png";
173+
const parameters = new LocationParameters(searchRegion, undefined, false);
174+
const expectedMatchRequest = new MatchRequest(
175+
expect.any(Image),
176+
join(cwd(), imagePath),
177+
searchRegion,
178+
SUT.config.confidence,
179+
false);
180+
181+
// WHEN
182+
await SUT.find(imagePath, parameters);
183+
184+
// THEN
185+
expect(visionAdapterMock.findOnScreenRegion).toHaveBeenCalledWith(expectedMatchRequest);
186+
});
187+
164188
it("should override both confidence and search region with parameter.", async () => {
165189
// GIVEN
166190
const minMatch = 0.8;

0 commit comments

Comments
 (0)