Skip to content

Commit

Permalink
fixup! Replace callbacks with promises
Browse files Browse the repository at this point in the history
  • Loading branch information
SemenchenkoVitaliy committed May 13, 2019
1 parent 6760d67 commit 713cb9f
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions test/filestorage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand Down Expand Up @@ -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 }) => {
Expand Down

0 comments on commit 713cb9f

Please sign in to comment.