import { TempSandbox } from 'temp-sandbox';
const sandbox = new TempSandbox();
let sandboxRandom = new TempSandbox({ randomDir: true });
beforeEach(async () => {
sandboxRandom = new TempSandbox({ randomDir: true });
await sandbox.clean();
sandbox.cleanSync();
});
afterAll(async () => {
await sandbox.destroySandbox();
sandbox.destroySandboxSync();
});
test('create file', async () => {
sandbox.path.resolve('file1.js');
sandbox.path.relative('<SANDBOX>/nested/file1.js');
sandbox.path.relative('nested', '<SANDBOX>/nested/file1.js');
await sandbox.createDir('nested/dir');
sandbox.createDirSync('nested/dir');
await sandbox.createFile('file1.js', '// file1.js');
sandbox.createFileSync('file1.js', '// file1.js');
await sandbox.readFile('file1.js');
sandbox.readFileSync('file1.js');
await sandbox.delete('file1.js');
sandbox.deleteSync('file1.js');
const fileList = await sandbox.getFileList();
const fileListSync = sandbox.getFileListSync();
const fileHashes = await sandbox.getAllFilesHash();
const fileHashesSync = sandbox.getAllFilesHashSync();
const file1Hash = await sandbox.getFileHash('file1.js');
const file1HashSync = sandbox.getFileHashSync('file1.js');
});