Skip to content

Commit 2b09f70

Browse files
committed
(#310) Migrated assert.class test to not use adapters
1 parent c5f8848 commit 2b09f70

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

lib/assert.class.spec.ts

+7-9
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
1-
import {VisionAdapter} from "./adapter/vision.adapter.class";
21
import {AssertClass} from "./assert.class";
32
import {Region} from "./region.class";
43
import {ScreenClass} from "./screen.class";
54
import providerRegistry from "./provider/provider-registry.class";
65

7-
jest.mock('jimp', () => {});
8-
jest.mock("./adapter/native.adapter.class");
9-
jest.mock("./adapter/vision.adapter.class");
6+
jest.mock('jimp', () => {
7+
});
108
jest.mock("./screen.class");
119

1210
describe("Assert", () => {
1311
it("isVisible should not throw if a match is found.", async () => {
1412
// GIVEN
1513
ScreenClass.prototype.find = jest.fn(() => Promise.resolve(new Region(0, 0, 100, 100)));
16-
const screenMock = new ScreenClass(new VisionAdapter(providerRegistry));
14+
const screenMock = new ScreenClass(providerRegistry);
1715
const SUT = new AssertClass(screenMock);
1816
const needle = "foo";
1917

@@ -26,7 +24,7 @@ describe("Assert", () => {
2624
it("isVisible should throw if a match is found.", async () => {
2725
// GIVEN
2826
ScreenClass.prototype.find = jest.fn(() => Promise.reject("foo"));
29-
const screenMock = new ScreenClass(new VisionAdapter(providerRegistry));
27+
const screenMock = new ScreenClass(providerRegistry);
3028
const SUT = new AssertClass(screenMock);
3129
const needle = "foo";
3230

@@ -39,7 +37,7 @@ describe("Assert", () => {
3937
it("isVisible should throw if a match is found.", async () => {
4038
// GIVEN
4139
ScreenClass.prototype.find = jest.fn(() => Promise.reject("foo"));
42-
const screenMock = new ScreenClass(new VisionAdapter(providerRegistry));
40+
const screenMock = new ScreenClass(providerRegistry);
4341
const SUT = new AssertClass(screenMock);
4442
const searchRegion = new Region(10, 10, 10, 10);
4543
const needle = "foo";
@@ -56,7 +54,7 @@ describe("Assert", () => {
5654
it("isNotVisible should throw if a match is found.", async () => {
5755
// GIVEN
5856
ScreenClass.prototype.find = jest.fn(() => Promise.resolve(new Region(0, 0, 100, 100)));
59-
const screenMock = new ScreenClass(new VisionAdapter(providerRegistry));
57+
const screenMock = new ScreenClass(providerRegistry);
6058
const SUT = new AssertClass(screenMock);
6159
const needle = "foo";
6260

@@ -69,7 +67,7 @@ describe("Assert", () => {
6967
it("isVisible should throw if a match is found.", async () => {
7068
// GIVEN
7169
ScreenClass.prototype.find = jest.fn(() => Promise.reject("foo"));
72-
const screenMock = new ScreenClass(new VisionAdapter(providerRegistry));
70+
const screenMock = new ScreenClass(providerRegistry);
7371
const SUT = new AssertClass(screenMock);
7472
const needle = "foo";
7573

0 commit comments

Comments
 (0)