forked from jprichardson/node-fs-extra
-
Notifications
You must be signed in to change notification settings - Fork 0
/
remove-dir.test.js
37 lines (32 loc) · 1010 Bytes
/
remove-dir.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
'use strict'
const fs = require('fs')
const os = require('os')
const fse = require(process.cwd())
const path = require('path')
const assert = require('assert')
/* global beforeEach, describe, it */
describe('remove / async / dir', () => {
let TEST_DIR
beforeEach(done => {
TEST_DIR = path.join(os.tmpdir(), 'fs-extra', 'remove-async-dir')
fse.emptyDir(TEST_DIR, done)
})
describe('> when dir does not exist', () => {
it('should not throw an error', done => {
const someDir = path.join(TEST_DIR, 'some-dir/')
assert.strictEqual(fs.existsSync(someDir), false)
fse.remove(someDir, err => {
assert.ifError(err)
done()
})
})
it('should throw an error if shoutMissing is set', done => {
const someDir = path.join(TEST_DIR, 'some-dir/')
assert.strictEqual(fs.existsSync(someDir), false)
fse.remove(someDir, { shoutMissing: true }, err => {
assert.strictEqual(err.code, 'ENOENT')
done()
})
})
})
})