nvim/coc/extensions/node_modules/coc-go/lib/utils/fs.test.js

29 lines
No EOL
1.2 KiB
JavaScript

"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');
fs_2.createDir(dirPath);
assert_1.default.ok(fs_1.default.existsSync(dirPath));
});
it('should create nested directories', () => {
const dirPath = joinPath('test', 'foo', 'bar');
fs_2.createDir(dirPath);
assert_1.default.ok(fs_1.default.existsSync(dirPath));
});
it('should not fail if directory exists', () => {
fs_2.createDir(tmpDir.name);
assert_1.default.ok(fs_1.default.existsSync(tmpDir.name));
});
});
//# sourceMappingURL=fs.test.js.map