1
- import { NativeAdapter } from "./adapter/native.adapter.class" ;
2
1
import { VisionAdapter } from "./adapter/vision.adapter.class" ;
3
2
import { Assert } from "./assert.class" ;
4
3
import { Region } from "./region.class" ;
@@ -11,23 +10,23 @@ jest.mock("./screen.class");
11
10
describe ( "Assert" , ( ) => {
12
11
it ( "isVisible should not throw if a match is found." , async ( ) => {
13
12
Screen . prototype . findOnScreen = jest . fn ( ( ) => Promise . resolve ( new Region ( 0 , 0 , 100 , 100 ) ) ) ;
14
- const screenMock = new Screen ( new VisionAdapter ( ) , new NativeAdapter ( ) ) ;
13
+ const screenMock = new Screen ( new VisionAdapter ( ) ) ;
15
14
const SUT = new Assert ( screenMock ) ;
16
15
17
16
await expect ( SUT . isVisible ( "foo" ) ) . resolves . not . toThrowError ( ) ;
18
17
} ) ;
19
18
20
19
it ( "isVisible should throw if a match is found." , async ( ) => {
21
20
Screen . prototype . findOnScreen = jest . fn ( ( ) => Promise . reject ( "foo" ) ) ;
22
- const screenMock = new Screen ( new VisionAdapter ( ) , new NativeAdapter ( ) ) ;
21
+ const screenMock = new Screen ( new VisionAdapter ( ) ) ;
23
22
const SUT = new Assert ( screenMock ) ;
24
23
25
24
await expect ( SUT . isVisible ( "foo" ) ) . rejects . toThrowError ( "Element not found" ) ;
26
25
} ) ;
27
26
28
27
it ( "isVisible should throw if a match is found." , async ( ) => {
29
28
Screen . prototype . findOnScreen = jest . fn ( ( ) => Promise . reject ( "foo" ) ) ;
30
- const screenMock = new Screen ( new VisionAdapter ( ) , new NativeAdapter ( ) ) ;
29
+ const screenMock = new Screen ( new VisionAdapter ( ) ) ;
31
30
const SUT = new Assert ( screenMock ) ;
32
31
const searchRegion = new Region ( 10 , 10 , 10 , 10 ) ;
33
32
@@ -39,15 +38,15 @@ describe("Assert", () => {
39
38
40
39
it ( "isNotVisible should throw if a match is found." , async ( ) => {
41
40
Screen . prototype . findOnScreen = jest . fn ( ( ) => Promise . resolve ( new Region ( 0 , 0 , 100 , 100 ) ) ) ;
42
- const screenMock = new Screen ( new VisionAdapter ( ) , new NativeAdapter ( ) ) ;
41
+ const screenMock = new Screen ( new VisionAdapter ( ) ) ;
43
42
const SUT = new Assert ( screenMock ) ;
44
43
45
44
await expect ( SUT . notVisible ( "foo" ) ) . rejects . toThrowError ( "Element visible" ) ;
46
45
} ) ;
47
46
48
47
it ( "isVisible should throw if a match is found." , async ( ) => {
49
48
Screen . prototype . findOnScreen = jest . fn ( ( ) => Promise . reject ( "foo" ) ) ;
50
- const screenMock = new Screen ( new VisionAdapter ( ) , new NativeAdapter ( ) ) ;
49
+ const screenMock = new Screen ( new VisionAdapter ( ) ) ;
51
50
const SUT = new Assert ( screenMock ) ;
52
51
53
52
await expect ( SUT . notVisible ( "foo" ) ) . resolves . not . toThrowError ( ) ;
0 commit comments