Luke Childs
8 years ago
1 changed files with 18 additions and 0 deletions
@ -0,0 +1,18 @@ |
|||
import test from 'ava' |
|||
import nock from 'nock' |
|||
import data from './fixtures/data' |
|||
import Onionoo from '../' |
|||
|
|||
test('Query string is built correctly', async t => { |
|||
const onionoo = new Onionoo() |
|||
|
|||
const defaultEndpoint = data.defaultEndpoints[0] |
|||
const scope = nock(data.defaultBaseUrl) |
|||
.get(`/${defaultEndpoint}?foo=bar`) |
|||
.reply(200, data.dummyResponse) |
|||
|
|||
const response = await onionoo[defaultEndpoint]({ foo: 'bar' }) |
|||
|
|||
t.deepEqual(response.body, data.dummyResponse) |
|||
t.truthy(scope.isDone()) |
|||
}) |
Loading…
Reference in new issue