@@ -140,6 +140,17 @@ describe('+ move()', () => {
140
140
} )
141
141
} )
142
142
143
+ it ( 'should support promises' , async ( ) => {
144
+ const src = path . join ( TEST_DIR , 'a-file' )
145
+ const dest = path . join ( TEST_DIR , 'a-file-dest' )
146
+
147
+ await fse . move ( src , dest )
148
+
149
+ const contents = fs . readFileSync ( dest , 'utf8' )
150
+ const expected = / ^ s o n i c t h e h e d g e h o g \r ? \n $ /
151
+ assert . ok ( contents . match ( expected ) )
152
+ } )
153
+
143
154
it ( 'should not move a file if source and destination are the same' , done => {
144
155
const src = path . join ( TEST_DIR , 'a-file' )
145
156
const dest = src
@@ -273,6 +284,34 @@ describe('+ move()', () => {
273
284
} )
274
285
} )
275
286
287
+ describe ( '> when opts is explicit undefined' , ( ) => {
288
+ it ( 'works with callbacks' , done => {
289
+ const src = path . join ( TEST_DIR , 'a-file' )
290
+ const dest = path . join ( TEST_DIR , 'a-file-dest' )
291
+
292
+ fse . move ( src , dest , undefined , err => {
293
+ assert . ifError ( err )
294
+ fs . readFile ( dest , 'utf8' , ( err , contents ) => {
295
+ const expected = / ^ s o n i c t h e h e d g e h o g \r ? \n $ /
296
+ assert . ifError ( err )
297
+ assert . ok ( contents . match ( expected ) )
298
+ done ( )
299
+ } )
300
+ } )
301
+ } )
302
+
303
+ it ( 'works with promises' , async ( ) => {
304
+ const src = path . join ( TEST_DIR , 'a-file' )
305
+ const dest = path . join ( TEST_DIR , 'a-file-dest' )
306
+
307
+ await fse . move ( src , dest , undefined )
308
+
309
+ const contents = fs . readFileSync ( dest , 'utf8' )
310
+ const expected = / ^ s o n i c t h e h e d g e h o g \r ? \n $ /
311
+ assert . ok ( contents . match ( expected ) )
312
+ } )
313
+ } )
314
+
276
315
describeIfWindows ( '> when dest parent is root' , ( ) => {
277
316
let dest
278
317
0 commit comments