blob: 28c3ec9747e3721584f75e755245ad77f6d4e366 (
plain)
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
|
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const tmp_1 = tslib_1.__importDefault(require("tmp"));
const assert_1 = tslib_1.__importDefault(require("assert"));
const path_1 = tslib_1.__importDefault(require("path"));
const fs_1 = tslib_1.__importDefault(require("fs"));
const fs_2 = require("./fs");
describe('createDir()', () => {
let tmpDir;
const joinPath = (...parts) => path_1.default.join(tmpDir.name, ...parts);
beforeEach(() => tmpDir = tmp_1.default.dirSync({ unsafeCleanup: true }));
afterEach(() => tmpDir.removeCallback());
it('should create a directory', () => {
const dirPath = joinPath('test');
(0, fs_2.createDir)(dirPath);
assert_1.default.ok(fs_1.default.existsSync(dirPath));
});
it('should create nested directories', () => {
const dirPath = joinPath('test', 'foo', 'bar');
(0, fs_2.createDir)(dirPath);
assert_1.default.ok(fs_1.default.existsSync(dirPath));
});
it('should not fail if directory exists', () => {
(0, fs_2.createDir)(tmpDir.name);
assert_1.default.ok(fs_1.default.existsSync(tmpDir.name));
});
});
//# sourceMappingURL=fs.test.js.map
|