1
+ import { join } from "path" ;
2
+ import { cwd } from "process" ;
1
3
import { VisionAdapter } from "./adapter/vision.adapter.class" ;
2
4
import { Image } from "./image.class" ;
3
5
import { LocationParameters } from "./locationparameters.class" ;
@@ -35,11 +37,11 @@ describe("Screen.", () => {
35
37
const imagePath = "test/path/to/image.png" ;
36
38
await expect ( SUT . find ( imagePath ) ) . resolves . toEqual ( matchResult . location ) ;
37
39
const matchRequest = new MatchRequest (
38
- expect . any ( Image ) ,
39
- imagePath ,
40
- searchRegion ,
41
- SUT . config . confidence ,
42
- true ) ;
40
+ expect . any ( Image ) ,
41
+ join ( cwd ( ) , imagePath ) ,
42
+ searchRegion ,
43
+ SUT . config . confidence ,
44
+ true ) ;
43
45
expect ( visionAdapterMock . findOnScreenRegion ) . toHaveBeenCalledWith ( matchRequest ) ;
44
46
} ) ;
45
47
@@ -55,8 +57,8 @@ describe("Screen.", () => {
55
57
const SUT = new Screen ( visionAdapterMock ) ;
56
58
const imagePath = "test/path/to/image.png" ;
57
59
await expect ( SUT . find ( imagePath ) )
58
- . rejects
59
- . toEqual ( `No match for ${ imagePath } . Required: ${ SUT . config . confidence } , given: ${ matchResult . confidence } ` ) ;
60
+ . rejects
61
+ . toEqual ( `No match for ${ imagePath } . Required: ${ SUT . config . confidence } , given: ${ matchResult . confidence } ` ) ;
60
62
} ) ;
61
63
62
64
it ( "should override default confidence value with parameter." , async ( ) => {
@@ -75,11 +77,11 @@ describe("Screen.", () => {
75
77
const parameters = new LocationParameters ( undefined , minMatch ) ;
76
78
await expect ( SUT . find ( imagePath , parameters ) ) . resolves . toEqual ( matchResult . location ) ;
77
79
const matchRequest = new MatchRequest (
78
- expect . any ( Image ) ,
79
- imagePath ,
80
- searchRegion ,
81
- minMatch ,
82
- true ) ;
80
+ expect . any ( Image ) ,
81
+ join ( cwd ( ) , imagePath ) ,
82
+ searchRegion ,
83
+ minMatch ,
84
+ true ) ;
83
85
expect ( visionAdapterMock . findOnScreenRegion ) . toHaveBeenCalledWith ( matchRequest ) ;
84
86
} ) ;
85
87
@@ -99,11 +101,11 @@ describe("Screen.", () => {
99
101
const parameters = new LocationParameters ( customSearchRegion ) ;
100
102
await expect ( SUT . find ( imagePath , parameters ) ) . resolves . toEqual ( matchResult . location ) ;
101
103
const matchRequest = new MatchRequest (
102
- expect . any ( Image ) ,
103
- imagePath ,
104
- customSearchRegion ,
105
- SUT . config . confidence ,
106
- true ) ;
104
+ expect . any ( Image ) ,
105
+ join ( cwd ( ) , imagePath ) ,
106
+ customSearchRegion ,
107
+ SUT . config . confidence ,
108
+ true ) ;
107
109
expect ( visionAdapterMock . findOnScreenRegion ) . toHaveBeenCalledWith ( matchRequest ) ;
108
110
} ) ;
109
111
@@ -124,11 +126,11 @@ describe("Screen.", () => {
124
126
const parameters = new LocationParameters ( customSearchRegion , minMatch ) ;
125
127
await expect ( SUT . find ( imagePath , parameters ) ) . resolves . toEqual ( matchResult . location ) ;
126
128
const matchRequest = new MatchRequest (
127
- expect . any ( Image ) ,
128
- imagePath ,
129
- customSearchRegion ,
130
- minMatch ,
131
- true ) ;
129
+ expect . any ( Image ) ,
130
+ join ( cwd ( ) , imagePath ) ,
131
+ customSearchRegion ,
132
+ minMatch ,
133
+ true ) ;
132
134
expect ( visionAdapterMock . findOnScreenRegion ) . toHaveBeenCalledWith ( matchRequest ) ;
133
135
} ) ;
134
136
} ) ;
0 commit comments