1+ import { join } from "path" ;
2+ import { cwd } from "process" ;
13import { VisionAdapter } from "./adapter/vision.adapter.class" ;
24import { Image } from "./image.class" ;
35import { LocationParameters } from "./locationparameters.class" ;
@@ -35,11 +37,11 @@ describe("Screen.", () => {
3537 const imagePath = "test/path/to/image.png" ;
3638 await expect ( SUT . find ( imagePath ) ) . resolves . toEqual ( matchResult . location ) ;
3739 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 ) ;
4345 expect ( visionAdapterMock . findOnScreenRegion ) . toHaveBeenCalledWith ( matchRequest ) ;
4446 } ) ;
4547
@@ -55,8 +57,8 @@ describe("Screen.", () => {
5557 const SUT = new Screen ( visionAdapterMock ) ;
5658 const imagePath = "test/path/to/image.png" ;
5759 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 } ` ) ;
6062 } ) ;
6163
6264 it ( "should override default confidence value with parameter." , async ( ) => {
@@ -75,11 +77,11 @@ describe("Screen.", () => {
7577 const parameters = new LocationParameters ( undefined , minMatch ) ;
7678 await expect ( SUT . find ( imagePath , parameters ) ) . resolves . toEqual ( matchResult . location ) ;
7779 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 ) ;
8385 expect ( visionAdapterMock . findOnScreenRegion ) . toHaveBeenCalledWith ( matchRequest ) ;
8486 } ) ;
8587
@@ -99,11 +101,11 @@ describe("Screen.", () => {
99101 const parameters = new LocationParameters ( customSearchRegion ) ;
100102 await expect ( SUT . find ( imagePath , parameters ) ) . resolves . toEqual ( matchResult . location ) ;
101103 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 ) ;
107109 expect ( visionAdapterMock . findOnScreenRegion ) . toHaveBeenCalledWith ( matchRequest ) ;
108110 } ) ;
109111
@@ -124,11 +126,11 @@ describe("Screen.", () => {
124126 const parameters = new LocationParameters ( customSearchRegion , minMatch ) ;
125127 await expect ( SUT . find ( imagePath , parameters ) ) . resolves . toEqual ( matchResult . location ) ;
126128 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 ) ;
132134 expect ( visionAdapterMock . findOnScreenRegion ) . toHaveBeenCalledWith ( matchRequest ) ;
133135 } ) ;
134136} ) ;
0 commit comments