@@ -30,8 +30,8 @@ describe('Sync', function () {
30
30
let client ! : Client ;
31
31
let deviceList : Device [ ] | null = null ;
32
32
// eslint-disable-next-line @typescript-eslint/no-explicit-any
33
- const forEachSyncDevice = function ( iterator : ( sync : Sync ) => any , done ) : Promise < Sync > {
34
- assert ( deviceList . length > 0 , 'At least one connected Android device is required' ) ;
33
+ const forEachSyncDevice = function ( iterator : ( sync : Sync ) => any ) : Promise < void > {
34
+ assert ( deviceList && deviceList . length > 0 , 'At least one connected Android device is required' ) ;
35
35
const promises = deviceList . map ( function ( device ) {
36
36
return client
37
37
. getDevice ( device . id )
@@ -43,9 +43,7 @@ describe('Sync', function () {
43
43
} ) ;
44
44
} ) ;
45
45
} ) ;
46
- return Promise . all ( promises )
47
- . then ( ( ) => done ( ) )
48
- . catch ( done ) ;
46
+ return Promise . all ( promises ) . then ( )
49
47
} ;
50
48
before ( function ( ) {
51
49
if ( process . env . RUN_DEVICE_TESTS ) {
@@ -99,7 +97,7 @@ describe('Sync', function () {
99
97
expect ( transfer ) . to . be . an . instanceof ( PushTransfer ) ;
100
98
return transfer . cancel ( ) ;
101
99
} ) ;
102
- return dt ( 'should be able to push >65536 byte chunks without error' , function ( done ) {
100
+ return dt ( 'should be able to push >65536 byte chunks without error' , function ( ) {
103
101
return forEachSyncDevice ( function ( sync ) {
104
102
return new Promise ( function ( resolve , reject ) {
105
103
const stream = new Stream . PassThrough ( ) ;
@@ -110,11 +108,11 @@ describe('Sync', function () {
110
108
stream . write ( content ) ;
111
109
return stream . end ( ) ;
112
110
} ) ;
113
- } , done ) ;
111
+ } ) ;
114
112
} ) ;
115
113
} ) ;
116
114
describe ( 'pull(path)' , function ( ) {
117
- dt ( 'should retrieve the same content pushStream() pushed' , function ( done ) {
115
+ dt ( 'should retrieve the same content pushStream() pushed' , function ( ) {
118
116
return forEachSyncDevice ( function ( sync ) {
119
117
return new Promise ( function ( resolve , reject ) {
120
118
const stream = new Stream . PassThrough ( ) ;
@@ -138,45 +136,45 @@ describe('Sync', function () {
138
136
stream . write ( content ) ;
139
137
return stream . end ( ) ;
140
138
} ) ;
141
- } , done ) ;
139
+ } ) ;
142
140
} ) ;
143
- dt ( 'should emit error for non-existing files' , function ( done ) {
141
+ dt ( 'should emit error for non-existing files' , function ( ) {
144
142
return forEachSyncDevice ( function ( sync ) {
145
143
return new Promise ( function ( resolve ) {
146
144
const transfer = sync . pull ( SURELY_NONEXISTING_PATH ) ;
147
145
return transfer . on ( 'error' , resolve ) ;
148
146
} ) ;
149
- } , done ) ;
147
+ } ) ;
150
148
} ) ;
151
- dt ( 'should return a PullTransfer instance' , function ( done ) {
149
+ dt ( 'should return a PullTransfer instance' , function ( ) {
152
150
return forEachSyncDevice ( function ( sync ) {
153
151
const rval = sync . pull ( SURELY_EXISTING_FILE ) ;
154
152
expect ( rval ) . to . be . an . instanceof ( PullTransfer ) ;
155
153
return rval . cancel ( ) ;
156
- } , done ) ;
154
+ } ) ;
157
155
} ) ;
158
156
return describe ( 'Stream' , function ( ) {
159
- return dt ( "should emit 'end' when pull is done" , function ( done ) {
157
+ return dt ( "should emit 'end' when pull is done" , function ( ) {
160
158
return forEachSyncDevice ( function ( sync ) {
161
159
return new Promise ( function ( resolve , reject ) {
162
160
const transfer = sync . pull ( SURELY_EXISTING_FILE ) ;
163
161
transfer . on ( 'error' , reject ) ;
164
162
transfer . on ( 'end' , resolve ) ;
165
163
return transfer . resume ( ) ;
166
164
} ) ;
167
- } , done ) ;
165
+ } ) ;
168
166
} ) ;
169
167
} ) ;
170
168
} ) ;
171
169
return describe ( 'stat(path)' , function ( ) {
172
- dt ( 'should return a Promise' , function ( done ) {
170
+ dt ( 'should return a Promise' , function ( ) {
173
171
return forEachSyncDevice ( function ( sync ) {
174
172
const rval = sync . stat ( SURELY_EXISTING_PATH ) ;
175
173
expect ( rval ) . to . be . an . instanceof ( Promise ) ;
176
174
return rval ;
177
- } , done ) ;
175
+ } ) ;
178
176
} ) ;
179
- dt ( 'should call with an ENOENT error if the path does not exist' , function ( done ) {
177
+ dt ( 'should call with an ENOENT error if the path does not exist' , function ( ) {
180
178
return forEachSyncDevice ( function ( sync ) {
181
179
return sync
182
180
. stat ( SURELY_NONEXISTING_PATH )
@@ -189,54 +187,54 @@ describe('Sync', function () {
189
187
expect ( err . errno ) . to . equal ( 34 ) ;
190
188
return expect ( err . path ) . to . equal ( SURELY_NONEXISTING_PATH ) ;
191
189
} ) ;
192
- } , done ) ;
190
+ } ) ;
193
191
} ) ;
194
- dt ( 'should call with an fs.Stats instance for an existing path' , function ( done ) {
192
+ dt ( 'should call with an fs.Stats instance for an existing path' , function ( ) {
195
193
return forEachSyncDevice ( function ( sync ) {
196
194
return sync . stat ( SURELY_EXISTING_PATH ) . then ( function ( stats ) {
197
195
return expect ( stats ) . to . be . an . instanceof ( Fs . Stats ) ;
198
196
} ) ;
199
- } , done ) ;
197
+ } ) ;
200
198
} ) ;
201
199
describe ( 'Stats' , function ( ) {
202
200
it ( 'should implement Fs.Stats' , function ( done ) {
203
201
expect ( new Stats ( 0 , BigInt ( 0 ) , 0 ) ) . to . be . an . instanceof ( Fs . Stats ) ;
204
202
done ( ) ;
205
203
} ) ;
206
- dt ( 'should set the `.mode` property for isFile() etc' , function ( done ) {
204
+ dt ( 'should set the `.mode` property for isFile() etc' , function ( ) {
207
205
return forEachSyncDevice ( function ( sync ) {
208
206
return sync . stat ( SURELY_EXISTING_FILE ) . then ( function ( stats ) {
209
207
expect ( stats ) . to . be . an . instanceof ( Fs . Stats ) ;
210
208
expect ( stats . mode ) . to . be . above ( 0 ) ;
211
209
expect ( stats . isFile ( ) ) . to . be . true ;
212
210
return expect ( stats . isDirectory ( ) ) . to . be . false ;
213
211
} ) ;
214
- } , done ) ;
212
+ } ) ;
215
213
} ) ;
216
- dt ( 'should set the `.size` property' , function ( done ) {
214
+ dt ( 'should set the `.size` property' , function ( ) {
217
215
return forEachSyncDevice ( function ( sync ) {
218
216
return sync . stat ( SURELY_EXISTING_FILE ) . then ( function ( stats ) {
219
217
expect ( stats ) . to . be . an . instanceof ( Fs . Stats ) ;
220
218
expect ( stats . isFile ( ) ) . to . be . true ;
221
219
return expect ( stats . size ) . to . be . above ( 0 ) ;
222
220
} ) ;
223
- } , done ) ;
221
+ } ) ;
224
222
} ) ;
225
- return dt ( 'should set the `.mtime` property' , function ( done ) {
223
+ return dt ( 'should set the `.mtime` property' , function ( ) {
226
224
return forEachSyncDevice ( function ( sync ) {
227
225
return sync . stat ( SURELY_EXISTING_FILE ) . then ( function ( stats ) {
228
226
expect ( stats ) . to . be . an . instanceof ( Fs . Stats ) ;
229
227
return expect ( stats . mtime ) . to . be . an . instanceof ( Date ) ;
230
228
} ) ;
231
- } , done ) ;
229
+ } ) ;
232
230
} ) ;
233
231
} ) ;
234
232
return describe ( 'Entry' , function ( ) {
235
233
it ( 'should implement Stats' , function ( done ) {
236
234
expect ( new Entry ( 'foo' , 0 , 0 , 0 ) ) . to . be . an . instanceof ( Stats ) ;
237
235
done ( ) ;
238
236
} ) ;
239
- dt ( 'should set the `.name` property' , function ( done ) {
237
+ dt ( 'should set the `.name` property' , function ( ) {
240
238
return forEachSyncDevice ( function ( sync ) {
241
239
return sync . readdir ( SURELY_EXISTING_PATH ) . then ( function ( files ) {
242
240
expect ( files ) . to . be . an ( 'Array' ) ;
@@ -245,9 +243,9 @@ describe('Sync', function () {
245
243
return expect ( file ) . to . be . an . instanceof ( Entry ) ;
246
244
} ) ;
247
245
} ) ;
248
- } , done ) ;
246
+ } ) ;
249
247
} ) ;
250
- return dt ( 'should set the Stats properties' , function ( done ) {
248
+ return dt ( 'should set the Stats properties' , function ( ) {
251
249
return forEachSyncDevice ( function ( sync ) {
252
250
return sync . readdir ( SURELY_EXISTING_PATH ) . then ( function ( files ) {
253
251
expect ( files ) . to . be . an ( 'Array' ) ;
@@ -257,7 +255,7 @@ describe('Sync', function () {
257
255
return expect ( file . mtime ) . to . not . be . null ;
258
256
} ) ;
259
257
} ) ;
260
- } , done ) ;
258
+ } ) ;
261
259
} ) ;
262
260
} ) ;
263
261
} ) ;
0 commit comments