@@ -11,7 +11,7 @@ jest.mock("../provider/native/robotjs-mouse-action.class");
11
11
jest . mock ( "../provider/native/robotjs-keyboard-action.class" ) ;
12
12
13
13
describe ( "NativeAdapter class" , ( ) => {
14
- it ( "should delegate calls to setMouseDelay" , ( ) => {
14
+ it ( "should delegate calls to setMouseDelay" , async ( ) => {
15
15
// GIVEN
16
16
const clipboardMock = new ClipboardAction ( ) ;
17
17
const keyboardMock = new KeyboardAction ( ) ;
@@ -20,14 +20,14 @@ describe("NativeAdapter class", () => {
20
20
const delay = 5 ;
21
21
22
22
// WHEN
23
- SUT . setMouseDelay ( delay ) ;
23
+ await SUT . setMouseDelay ( delay ) ;
24
24
25
25
// THEN
26
26
expect ( mouseMock . setMouseDelay ) . toBeCalledTimes ( 1 ) ;
27
27
expect ( mouseMock . setMouseDelay ) . toBeCalledWith ( delay ) ;
28
28
} ) ;
29
29
30
- it ( "should delegate calls to setMousePosition" , ( ) => {
30
+ it ( "should delegate calls to setMousePosition" , async ( ) => {
31
31
// GIVEN
32
32
const clipboardMock = new ClipboardAction ( ) ;
33
33
const keyboardMock = new KeyboardAction ( ) ;
@@ -36,70 +36,70 @@ describe("NativeAdapter class", () => {
36
36
const newPosition = new Point ( 10 , 10 ) ;
37
37
38
38
// WHEN
39
- SUT . setMousePosition ( newPosition ) ;
39
+ await SUT . setMousePosition ( newPosition ) ;
40
40
41
41
// THEN
42
42
expect ( mouseMock . setMousePosition ) . toBeCalledTimes ( 1 ) ;
43
43
expect ( mouseMock . setMousePosition ) . toBeCalledWith ( newPosition ) ;
44
44
} ) ;
45
45
46
- it ( "should delegate calls to currentMousePosition" , ( ) => {
46
+ it ( "should delegate calls to currentMousePosition" , async ( ) => {
47
47
// GIVEN
48
48
const clipboardMock = new ClipboardAction ( ) ;
49
49
const keyboardMock = new KeyboardAction ( ) ;
50
50
const mouseMock = new MouseAction ( ) ;
51
51
const SUT = new NativeAdapter ( clipboardMock , keyboardMock , mouseMock ) ;
52
52
53
53
// WHEN
54
- SUT . currentMousePosition ( ) ;
54
+ await SUT . currentMousePosition ( ) ;
55
55
56
56
// THEN
57
57
expect ( mouseMock . currentMousePosition ) . toBeCalledTimes ( 1 ) ;
58
58
} ) ;
59
59
60
- it ( "should delegate calls to leftClick" , ( ) => {
60
+ it ( "should delegate calls to leftClick" , async ( ) => {
61
61
// GIVEN
62
62
const clipboardMock = new ClipboardAction ( ) ;
63
63
const keyboardMock = new KeyboardAction ( ) ;
64
64
const mouseMock = new MouseAction ( ) ;
65
65
const SUT = new NativeAdapter ( clipboardMock , keyboardMock , mouseMock ) ;
66
66
67
67
// WHEN
68
- SUT . leftClick ( ) ;
68
+ await SUT . leftClick ( ) ;
69
69
70
70
// THEN
71
71
expect ( mouseMock . leftClick ) . toBeCalledTimes ( 1 ) ;
72
72
} ) ;
73
73
74
- it ( "should delegate calls to rightClick" , ( ) => {
74
+ it ( "should delegate calls to rightClick" , async ( ) => {
75
75
// GIVEN
76
76
const clipboardMock = new ClipboardAction ( ) ;
77
77
const keyboardMock = new KeyboardAction ( ) ;
78
78
const mouseMock = new MouseAction ( ) ;
79
79
const SUT = new NativeAdapter ( clipboardMock , keyboardMock , mouseMock ) ;
80
80
81
81
// WHEN
82
- SUT . rightClick ( ) ;
82
+ await SUT . rightClick ( ) ;
83
83
84
84
// THEN
85
85
expect ( mouseMock . rightClick ) . toBeCalledTimes ( 1 ) ;
86
86
} ) ;
87
87
88
- it ( "should delegate calls to middleClick" , ( ) => {
88
+ it ( "should delegate calls to middleClick" , async ( ) => {
89
89
// GIVEN
90
90
const clipboardMock = new ClipboardAction ( ) ;
91
91
const keyboardMock = new KeyboardAction ( ) ;
92
92
const mouseMock = new MouseAction ( ) ;
93
93
const SUT = new NativeAdapter ( clipboardMock , keyboardMock , mouseMock ) ;
94
94
95
95
// WHEN
96
- SUT . middleClick ( ) ;
96
+ await SUT . middleClick ( ) ;
97
97
98
98
// THEN
99
99
expect ( mouseMock . middleClick ) . toBeCalledTimes ( 1 ) ;
100
100
} ) ;
101
101
102
- it ( "should delegate calls to pressButton" , ( ) => {
102
+ it ( "should delegate calls to pressButton" , async ( ) => {
103
103
// GIVEN
104
104
const clipboardMock = new ClipboardAction ( ) ;
105
105
const keyboardMock = new KeyboardAction ( ) ;
@@ -108,14 +108,14 @@ describe("NativeAdapter class", () => {
108
108
const buttonToPress = Button . LEFT ;
109
109
110
110
// WHEN
111
- SUT . pressButton ( buttonToPress ) ;
111
+ await SUT . pressButton ( buttonToPress ) ;
112
112
113
113
// THEN
114
114
expect ( mouseMock . pressButton ) . toBeCalledTimes ( 1 ) ;
115
115
expect ( mouseMock . pressButton ) . toBeCalledWith ( buttonToPress ) ;
116
116
} ) ;
117
117
118
- it ( "should delegate calls to releaseButton" , ( ) => {
118
+ it ( "should delegate calls to releaseButton" , async ( ) => {
119
119
// GIVEN
120
120
const clipboardMock = new ClipboardAction ( ) ;
121
121
const keyboardMock = new KeyboardAction ( ) ;
@@ -124,14 +124,14 @@ describe("NativeAdapter class", () => {
124
124
const buttonToRelease = Button . LEFT ;
125
125
126
126
// WHEN
127
- SUT . releaseButton ( buttonToRelease ) ;
127
+ await SUT . releaseButton ( buttonToRelease ) ;
128
128
129
129
// THEN
130
130
expect ( mouseMock . releaseButton ) . toBeCalledTimes ( 1 ) ;
131
131
expect ( mouseMock . releaseButton ) . toBeCalledWith ( buttonToRelease ) ;
132
132
} ) ;
133
133
134
- it ( "should delegate calls to pressKey" , ( ) => {
134
+ it ( "should delegate calls to pressKey" , async ( ) => {
135
135
// GIVEN
136
136
const clipboardMock = new ClipboardAction ( ) ;
137
137
const keyboardMock = new KeyboardAction ( ) ;
@@ -140,14 +140,14 @@ describe("NativeAdapter class", () => {
140
140
const keyToPress = Key . A ;
141
141
142
142
// WHEN
143
- SUT . pressKey ( keyToPress ) ;
143
+ await SUT . pressKey ( keyToPress ) ;
144
144
145
145
// THEN
146
146
expect ( keyboardMock . pressKey ) . toBeCalledTimes ( 1 ) ;
147
147
expect ( keyboardMock . pressKey ) . toBeCalledWith ( keyToPress ) ;
148
148
} ) ;
149
149
150
- it ( "should delegate calls to releaseButton" , ( ) => {
150
+ it ( "should delegate calls to releaseButton" , async ( ) => {
151
151
// GIVEN
152
152
const clipboardMock = new ClipboardAction ( ) ;
153
153
const keyboardMock = new KeyboardAction ( ) ;
@@ -156,14 +156,14 @@ describe("NativeAdapter class", () => {
156
156
const keyToRelease = Key . A ;
157
157
158
158
// WHEN
159
- SUT . releaseKey ( keyToRelease ) ;
159
+ await SUT . releaseKey ( keyToRelease ) ;
160
160
161
161
// THEN
162
162
expect ( keyboardMock . releaseKey ) . toBeCalledTimes ( 1 ) ;
163
163
expect ( keyboardMock . releaseKey ) . toBeCalledWith ( keyToRelease ) ;
164
164
} ) ;
165
165
166
- it ( "should delegate calls to click" , ( ) => {
166
+ it ( "should delegate calls to click" , async ( ) => {
167
167
// GIVEN
168
168
const clipboardMock = new ClipboardAction ( ) ;
169
169
const keyboardMock = new KeyboardAction ( ) ;
@@ -172,14 +172,14 @@ describe("NativeAdapter class", () => {
172
172
const keyToClick = Key . A ;
173
173
174
174
// WHEN
175
- SUT . click ( keyToClick ) ;
175
+ await SUT . click ( keyToClick ) ;
176
176
177
177
// THEN
178
178
expect ( keyboardMock . click ) . toBeCalledTimes ( 1 ) ;
179
179
expect ( keyboardMock . click ) . toBeCalledWith ( keyToClick ) ;
180
180
} ) ;
181
181
182
- it ( "should delegate calls to type" , ( ) => {
182
+ it ( "should delegate calls to type" , async ( ) => {
183
183
// GIVEN
184
184
const clipboardMock = new ClipboardAction ( ) ;
185
185
const keyboardMock = new KeyboardAction ( ) ;
@@ -188,14 +188,14 @@ describe("NativeAdapter class", () => {
188
188
const stringToType = "testString" ;
189
189
190
190
// WHEN
191
- SUT . type ( stringToType ) ;
191
+ await SUT . type ( stringToType ) ;
192
192
193
193
// THEN
194
194
expect ( keyboardMock . type ) . toBeCalledTimes ( 1 ) ;
195
195
expect ( keyboardMock . type ) . toBeCalledWith ( stringToType ) ;
196
196
} ) ;
197
197
198
- it ( "should delegate calls to copy" , ( ) => {
198
+ it ( "should delegate calls to copy" , async ( ) => {
199
199
// GIVEN
200
200
const clipboardMock = new ClipboardAction ( ) ;
201
201
const keyboardMock = new KeyboardAction ( ) ;
@@ -204,22 +204,22 @@ describe("NativeAdapter class", () => {
204
204
const stringToCopy = "testString" ;
205
205
206
206
// WHEN
207
- SUT . copy ( stringToCopy ) ;
207
+ await SUT . copy ( stringToCopy ) ;
208
208
209
209
// THEN
210
210
expect ( clipboardMock . copy ) . toBeCalledTimes ( 1 ) ;
211
211
expect ( clipboardMock . copy ) . toBeCalledWith ( stringToCopy ) ;
212
212
} ) ;
213
213
214
- it ( "should delegate calls to paste" , ( ) => {
214
+ it ( "should delegate calls to paste" , async ( ) => {
215
215
// GIVEN
216
216
const clipboardMock = new ClipboardAction ( ) ;
217
217
const keyboardMock = new KeyboardAction ( ) ;
218
218
const mouseMock = new MouseAction ( ) ;
219
219
const SUT = new NativeAdapter ( clipboardMock , keyboardMock , mouseMock ) ;
220
220
221
221
// WHEN
222
- SUT . paste ( ) ;
222
+ await SUT . paste ( ) ;
223
223
224
224
// THEN
225
225
expect ( clipboardMock . paste ) . toBeCalledTimes ( 1 ) ;
0 commit comments