Skip to content

Commit

Permalink
refactor some throws calls to throwsAsync
Browse files Browse the repository at this point in the history
error from ava:
Function returned a promise. Use `t.throwsAsync()` instead:
  • Loading branch information
davidgovea committed Feb 14, 2019
1 parent 5613fdb commit fc83fe7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions test/node.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,21 +68,21 @@ test('should allow removal of auth() header', t => {

test('should throw an error if we fail to pass a string `path`', async t => {
const api = new Frisbee(options);
const error = await t.throws(() => api.get({}));
const error = await t.throwsAsync(api.get({}));
t.is(error.message, '`path` must be a string');
});

test(`should throw an error if we fail to pass an object options`, async t => {
const api = new Frisbee(options);
let error = await t.throws(() => api.get('', []));
let error = await t.throwsAsync(() => api.get('', []));
t.is(error.message, '`options` must be an object');
error = await t.throws(() => api.get('', 1));
error = await t.throwsAsync(() => api.get('', 1));
t.is(error.message, '`options` must be an object');
});

test('should throw an error if we pass a non object `options`', async t => {
const api = new Frisbee(options);
const error = await t.throws(() => api.get('', false));
const error = await t.throwsAsync(() => api.get('', false));
t.is(error.message, '`options` must be an object');
});

Expand Down

0 comments on commit fc83fe7

Please sign in to comment.