diff --git a/test/endpoints.js b/test/endpoints.js index 6f97c27..84ccb63 100644 --- a/test/endpoints.js +++ b/test/endpoints.js @@ -32,3 +32,17 @@ test('Can pass in custom endpoint array', t => { t.deepEqual(Object.keys(onionoo), endpoints) }) + +test('Custom endpoint makes correct request', async t => { + const customEndpoint = 'foo' + const onionoo = new Onionoo({ endpoints: [customEndpoint] }) + + const scope = nock(data.defaultBaseUrl) + .get(`/${customEndpoint}`) + .reply(200, data.dummyResponse) + + const response = await onionoo[customEndpoint]() + + t.deepEqual(response.body, data.dummyResponse) + t.truthy(scope.isDone()) +})