From 21eef32886d309f9a5d6bf99bbf036735aea64bb Mon Sep 17 00:00:00 2001 From: Luke Childs Date: Thu, 22 Dec 2016 14:07:34 +0700 Subject: [PATCH] Add test for custom endpoint request --- test/endpoints.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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()) +})