@@ -11,7 +11,7 @@ jest.mock("../provider/native/robotjs-mouse-action.class");
1111jest . mock ( "../provider/native/robotjs-keyboard-action.class" ) ;
1212
1313describe ( "NativeAdapter class" , ( ) => {
14- it ( "should delegate calls to setMouseDelay" , ( ) => {
14+ it ( "should delegate calls to setMouseDelay" , async ( ) => {
1515 // GIVEN
1616 const clipboardMock = new ClipboardAction ( ) ;
1717 const keyboardMock = new KeyboardAction ( ) ;
@@ -20,14 +20,14 @@ describe("NativeAdapter class", () => {
2020 const delay = 5 ;
2121
2222 // WHEN
23- SUT . setMouseDelay ( delay ) ;
23+ await SUT . setMouseDelay ( delay ) ;
2424
2525 // THEN
2626 expect ( mouseMock . setMouseDelay ) . toBeCalledTimes ( 1 ) ;
2727 expect ( mouseMock . setMouseDelay ) . toBeCalledWith ( delay ) ;
2828 } ) ;
2929
30- it ( "should delegate calls to setMousePosition" , ( ) => {
30+ it ( "should delegate calls to setMousePosition" , async ( ) => {
3131 // GIVEN
3232 const clipboardMock = new ClipboardAction ( ) ;
3333 const keyboardMock = new KeyboardAction ( ) ;
@@ -36,70 +36,70 @@ describe("NativeAdapter class", () => {
3636 const newPosition = new Point ( 10 , 10 ) ;
3737
3838 // WHEN
39- SUT . setMousePosition ( newPosition ) ;
39+ await SUT . setMousePosition ( newPosition ) ;
4040
4141 // THEN
4242 expect ( mouseMock . setMousePosition ) . toBeCalledTimes ( 1 ) ;
4343 expect ( mouseMock . setMousePosition ) . toBeCalledWith ( newPosition ) ;
4444 } ) ;
4545
46- it ( "should delegate calls to currentMousePosition" , ( ) => {
46+ it ( "should delegate calls to currentMousePosition" , async ( ) => {
4747 // GIVEN
4848 const clipboardMock = new ClipboardAction ( ) ;
4949 const keyboardMock = new KeyboardAction ( ) ;
5050 const mouseMock = new MouseAction ( ) ;
5151 const SUT = new NativeAdapter ( clipboardMock , keyboardMock , mouseMock ) ;
5252
5353 // WHEN
54- SUT . currentMousePosition ( ) ;
54+ await SUT . currentMousePosition ( ) ;
5555
5656 // THEN
5757 expect ( mouseMock . currentMousePosition ) . toBeCalledTimes ( 1 ) ;
5858 } ) ;
5959
60- it ( "should delegate calls to leftClick" , ( ) => {
60+ it ( "should delegate calls to leftClick" , async ( ) => {
6161 // GIVEN
6262 const clipboardMock = new ClipboardAction ( ) ;
6363 const keyboardMock = new KeyboardAction ( ) ;
6464 const mouseMock = new MouseAction ( ) ;
6565 const SUT = new NativeAdapter ( clipboardMock , keyboardMock , mouseMock ) ;
6666
6767 // WHEN
68- SUT . leftClick ( ) ;
68+ await SUT . leftClick ( ) ;
6969
7070 // THEN
7171 expect ( mouseMock . leftClick ) . toBeCalledTimes ( 1 ) ;
7272 } ) ;
7373
74- it ( "should delegate calls to rightClick" , ( ) => {
74+ it ( "should delegate calls to rightClick" , async ( ) => {
7575 // GIVEN
7676 const clipboardMock = new ClipboardAction ( ) ;
7777 const keyboardMock = new KeyboardAction ( ) ;
7878 const mouseMock = new MouseAction ( ) ;
7979 const SUT = new NativeAdapter ( clipboardMock , keyboardMock , mouseMock ) ;
8080
8181 // WHEN
82- SUT . rightClick ( ) ;
82+ await SUT . rightClick ( ) ;
8383
8484 // THEN
8585 expect ( mouseMock . rightClick ) . toBeCalledTimes ( 1 ) ;
8686 } ) ;
8787
88- it ( "should delegate calls to middleClick" , ( ) => {
88+ it ( "should delegate calls to middleClick" , async ( ) => {
8989 // GIVEN
9090 const clipboardMock = new ClipboardAction ( ) ;
9191 const keyboardMock = new KeyboardAction ( ) ;
9292 const mouseMock = new MouseAction ( ) ;
9393 const SUT = new NativeAdapter ( clipboardMock , keyboardMock , mouseMock ) ;
9494
9595 // WHEN
96- SUT . middleClick ( ) ;
96+ await SUT . middleClick ( ) ;
9797
9898 // THEN
9999 expect ( mouseMock . middleClick ) . toBeCalledTimes ( 1 ) ;
100100 } ) ;
101101
102- it ( "should delegate calls to pressButton" , ( ) => {
102+ it ( "should delegate calls to pressButton" , async ( ) => {
103103 // GIVEN
104104 const clipboardMock = new ClipboardAction ( ) ;
105105 const keyboardMock = new KeyboardAction ( ) ;
@@ -108,14 +108,14 @@ describe("NativeAdapter class", () => {
108108 const buttonToPress = Button . LEFT ;
109109
110110 // WHEN
111- SUT . pressButton ( buttonToPress ) ;
111+ await SUT . pressButton ( buttonToPress ) ;
112112
113113 // THEN
114114 expect ( mouseMock . pressButton ) . toBeCalledTimes ( 1 ) ;
115115 expect ( mouseMock . pressButton ) . toBeCalledWith ( buttonToPress ) ;
116116 } ) ;
117117
118- it ( "should delegate calls to releaseButton" , ( ) => {
118+ it ( "should delegate calls to releaseButton" , async ( ) => {
119119 // GIVEN
120120 const clipboardMock = new ClipboardAction ( ) ;
121121 const keyboardMock = new KeyboardAction ( ) ;
@@ -124,14 +124,14 @@ describe("NativeAdapter class", () => {
124124 const buttonToRelease = Button . LEFT ;
125125
126126 // WHEN
127- SUT . releaseButton ( buttonToRelease ) ;
127+ await SUT . releaseButton ( buttonToRelease ) ;
128128
129129 // THEN
130130 expect ( mouseMock . releaseButton ) . toBeCalledTimes ( 1 ) ;
131131 expect ( mouseMock . releaseButton ) . toBeCalledWith ( buttonToRelease ) ;
132132 } ) ;
133133
134- it ( "should delegate calls to pressKey" , ( ) => {
134+ it ( "should delegate calls to pressKey" , async ( ) => {
135135 // GIVEN
136136 const clipboardMock = new ClipboardAction ( ) ;
137137 const keyboardMock = new KeyboardAction ( ) ;
@@ -140,14 +140,14 @@ describe("NativeAdapter class", () => {
140140 const keyToPress = Key . A ;
141141
142142 // WHEN
143- SUT . pressKey ( keyToPress ) ;
143+ await SUT . pressKey ( keyToPress ) ;
144144
145145 // THEN
146146 expect ( keyboardMock . pressKey ) . toBeCalledTimes ( 1 ) ;
147147 expect ( keyboardMock . pressKey ) . toBeCalledWith ( keyToPress ) ;
148148 } ) ;
149149
150- it ( "should delegate calls to releaseButton" , ( ) => {
150+ it ( "should delegate calls to releaseButton" , async ( ) => {
151151 // GIVEN
152152 const clipboardMock = new ClipboardAction ( ) ;
153153 const keyboardMock = new KeyboardAction ( ) ;
@@ -156,14 +156,14 @@ describe("NativeAdapter class", () => {
156156 const keyToRelease = Key . A ;
157157
158158 // WHEN
159- SUT . releaseKey ( keyToRelease ) ;
159+ await SUT . releaseKey ( keyToRelease ) ;
160160
161161 // THEN
162162 expect ( keyboardMock . releaseKey ) . toBeCalledTimes ( 1 ) ;
163163 expect ( keyboardMock . releaseKey ) . toBeCalledWith ( keyToRelease ) ;
164164 } ) ;
165165
166- it ( "should delegate calls to click" , ( ) => {
166+ it ( "should delegate calls to click" , async ( ) => {
167167 // GIVEN
168168 const clipboardMock = new ClipboardAction ( ) ;
169169 const keyboardMock = new KeyboardAction ( ) ;
@@ -172,14 +172,14 @@ describe("NativeAdapter class", () => {
172172 const keyToClick = Key . A ;
173173
174174 // WHEN
175- SUT . click ( keyToClick ) ;
175+ await SUT . click ( keyToClick ) ;
176176
177177 // THEN
178178 expect ( keyboardMock . click ) . toBeCalledTimes ( 1 ) ;
179179 expect ( keyboardMock . click ) . toBeCalledWith ( keyToClick ) ;
180180 } ) ;
181181
182- it ( "should delegate calls to type" , ( ) => {
182+ it ( "should delegate calls to type" , async ( ) => {
183183 // GIVEN
184184 const clipboardMock = new ClipboardAction ( ) ;
185185 const keyboardMock = new KeyboardAction ( ) ;
@@ -188,14 +188,14 @@ describe("NativeAdapter class", () => {
188188 const stringToType = "testString" ;
189189
190190 // WHEN
191- SUT . type ( stringToType ) ;
191+ await SUT . type ( stringToType ) ;
192192
193193 // THEN
194194 expect ( keyboardMock . type ) . toBeCalledTimes ( 1 ) ;
195195 expect ( keyboardMock . type ) . toBeCalledWith ( stringToType ) ;
196196 } ) ;
197197
198- it ( "should delegate calls to copy" , ( ) => {
198+ it ( "should delegate calls to copy" , async ( ) => {
199199 // GIVEN
200200 const clipboardMock = new ClipboardAction ( ) ;
201201 const keyboardMock = new KeyboardAction ( ) ;
@@ -204,22 +204,22 @@ describe("NativeAdapter class", () => {
204204 const stringToCopy = "testString" ;
205205
206206 // WHEN
207- SUT . copy ( stringToCopy ) ;
207+ await SUT . copy ( stringToCopy ) ;
208208
209209 // THEN
210210 expect ( clipboardMock . copy ) . toBeCalledTimes ( 1 ) ;
211211 expect ( clipboardMock . copy ) . toBeCalledWith ( stringToCopy ) ;
212212 } ) ;
213213
214- it ( "should delegate calls to paste" , ( ) => {
214+ it ( "should delegate calls to paste" , async ( ) => {
215215 // GIVEN
216216 const clipboardMock = new ClipboardAction ( ) ;
217217 const keyboardMock = new KeyboardAction ( ) ;
218218 const mouseMock = new MouseAction ( ) ;
219219 const SUT = new NativeAdapter ( clipboardMock , keyboardMock , mouseMock ) ;
220220
221221 // WHEN
222- SUT . paste ( ) ;
222+ await SUT . paste ( ) ;
223223
224224 // THEN
225225 expect ( clipboardMock . paste ) . toBeCalledTimes ( 1 ) ;
0 commit comments