Skip to content

Commit

Permalink
Fixes async tests (patch)
Browse files Browse the repository at this point in the history
  • Loading branch information
zrrrzzt committed Feb 5, 2019
1 parent 0bf074e commit bcc7157
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion test/modules/get-token-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ test('it errors with wrong username', async t => {
}
}
}
const { response } = await t.throws(getToken(options))
const { response } = await t.throwsAsync(getToken(options))
t.is(response.data.error, 'invalid_grant', 'Errors as expected')
})
18 changes: 9 additions & 9 deletions test/modules/input-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@ const test = require('ava')
const getToken = require('../../index')

test('throws if missing options', async t => {
const error = await t.throws(getToken())
const error = await t.throwsAsync(getToken())
t.is(error.message, 'Missing required input: options')
})

test('throws if missing options.url', async t => {
const options = {
url: false
}
const error = await t.throws(getToken(options))
const error = await t.throwsAsync(getToken(options))
t.is(error.message, 'Missing required input: options.url')
})

Expand All @@ -19,7 +19,7 @@ test('throws if missing options.credentials', async t => {
url: 'http://url.com',
credentials: false
}
const error = await t.throws(getToken(options))
const error = await t.throwsAsync(getToken(options))
t.is(error.message, 'Missing required input: options.credentials')
})

Expand All @@ -30,7 +30,7 @@ test('throws if missing options.credentials.auth', async t => {
auth: false
}
}
const error = await t.throws(getToken(options))
const error = await t.throwsAsync(getToken(options))
t.is(error.message, 'Missing required input: options.credentials.auth')
})

Expand All @@ -43,7 +43,7 @@ test('throws if missing options.credentials.auth.username', async t => {
}
}
}
const error = await t.throws(getToken(options))
const error = await t.throwsAsync(getToken(options))
t.is(error.message, 'Missing required input: options.credentials.auth.username')
})

Expand All @@ -57,7 +57,7 @@ test('throws if missing options.credentials.auth.password', async t => {
}
}
}
const error = await t.throws(getToken(options))
const error = await t.throwsAsync(getToken(options))
t.is(error.message, 'Missing required input: options.credentials.auth.password')
})

Expand All @@ -72,7 +72,7 @@ test('throws if missing options.credentials.client', async t => {
client: false
}
}
const error = await t.throws(getToken(options))
const error = await t.throwsAsync(getToken(options))
t.is(error.message, 'Missing required input: options.credentials.client')
})

Expand All @@ -89,7 +89,7 @@ test('throws if missing options.credentials.client.client_id', async t => {
}
}
}
const error = await t.throws(getToken(options))
const error = await t.throwsAsync(getToken(options))
t.is(error.message, 'Missing required input: options.credentials.client.client_id')
})

Expand All @@ -107,6 +107,6 @@ test('throws if missing options.credentials.client.client_secret', async t => {
}
}
}
const error = await t.throws(getToken(options))
const error = await t.throwsAsync(getToken(options))
t.is(error.message, 'Missing required input: options.credentials.client.client_secret')
})

0 comments on commit bcc7157

Please sign in to comment.