diff --git a/test/filestorage.js b/test/filestorage.js index 538b17f..3048634 100644 --- a/test/filestorage.js +++ b/test/filestorage.js @@ -20,7 +20,14 @@ fsTest.beforeEach(async () => { return { storage }; }); -fsTest.afterEach(async () => utils.rmRecursive(testDir)); +fsTest.afterEach(async (test, cb) => { + try { + await utils.rmRecursive(testDir); + } catch (err) { + test.fail(err); + } + cb(); +}); fsTest.test('Create root directory on create', () => fs.access(testDir)); @@ -188,12 +195,11 @@ fsTest.test('Write and read big file', async (test, { storage }) => { const dataSize = 6000; const { checksum, dedupHash, size } = await storage.write(id, data, opts); - const d = await storage.read(id, { encoding: 'utf8' }); - test.strictSame(checksum, cs); test.strictSame(dedupHash, dh); test.strictSame(size, dataSize); - test.strictSame(d, data); + + test.resolves(storage.read(id, { encoding: 'utf8' }), data); }); fsTest.test('Write, compress and read big file', async (test, { storage }) => {