This repository was archived by the owner on Mar 10, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change 1
1
'use strict'
2
2
3
+ const waterfall = require ( 'async/waterfall' )
4
+ const stat = require ( './stat' )
5
+
3
6
const {
4
7
FILE_SEPARATOR
5
8
} = require ( './utils' )
@@ -25,6 +28,9 @@ module.exports = (context) => {
25
28
26
29
options = Object . assign ( { } , defaultOptions , options )
27
30
28
- callback ( )
31
+ waterfall ( [
32
+ ( cb ) => stat ( context ) ( path , options , cb ) ,
33
+ ( stats , cb ) => cb ( )
34
+ ] , callback )
29
35
}
30
36
}
Original file line number Diff line number Diff line change 1
1
/* eslint-env mocha */
2
2
'use strict'
3
3
4
+ const chai = require ( 'chai' )
5
+ chai . use ( require ( 'dirty-chai' ) )
6
+ const expect = chai . expect
4
7
const {
5
8
createMfs
6
9
} = require ( './helpers' )
@@ -18,4 +21,13 @@ describe('flush', function () {
18
21
it ( 'flushes the root node' , ( ) => {
19
22
return mfs . flush ( )
20
23
} )
24
+
25
+ it ( 'throws a error when trying to flush non-existent directories' , async ( ) => {
26
+ try {
27
+ await mfs . flush ( `/some-dir-${ Math . random ( ) } ` )
28
+ throw new Error ( 'No error was thrown' )
29
+ } catch ( err ) {
30
+ expect ( err . message ) . to . include ( 'does not exist' )
31
+ }
32
+ } )
21
33
} )
You can’t perform that action at this time.
0 commit comments