Skip to content

Commit

Permalink
refactor(test): rewrite flaky test in promises to see error message (#…
Browse files Browse the repository at this point in the history
…1103)

* refactor(test): rewrite flaky test in promises to see error

* awaits

* must await assert.rejects

* npm run fix
  • Loading branch information
jkwlui authored Mar 13, 2020
1 parent 39869e3 commit 404a11f
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions system-test/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -233,20 +233,18 @@ describe('storage', () => {
it('should not download a file', async () => {
const [isPublic] = await file.isPublic();
assert.strictEqual(isPublic, false);
assert.rejects(
await assert.rejects(
file.download(),
(err: Error) =>
err.message.indexOf('does not have storage.objects.get') > -1
);
});

it('should not upload a file', done => {
file.save('new data', err => {
assert(
err!.message.indexOf('Could not load the default credentials') > -1
);
done();
});
it('should not upload a file', async () => {
await assert.rejects(
() => file.save('new data'),
/Could not load the default credentials/
);
});
});
});
Expand Down

0 comments on commit 404a11f

Please sign in to comment.