Browse Source

Use xo-lukechilds

pull/49/head
Luke Childs 7 years ago
parent
commit
6f157abd0f
  1. 4
      package.json
  2. 2
      test/base-url.js
  3. 2
      test/cache.js
  4. 4
      test/endpoints.js
  5. 4
      test/queries.js

4
package.json

@ -8,6 +8,9 @@
"lint": "xo",
"coverage": "nyc report --reporter=text-lcov | coveralls"
},
"xo": {
"extends": "xo-lukechilds"
},
"repository": {
"type": "git",
"url": "git+https://github.com/lukechilds/onionoo-node-client.git"
@ -31,6 +34,7 @@
"devDependencies": {
"ava": "^0.24.0",
"coveralls": "^3.0.0",
"eslint-config-xo-lukechilds": "^1.0.1",
"nock": "^9.0.2",
"nyc": "^11.0.0",
"xo": "^0.19.0"

2
test/base-url.js

@ -6,7 +6,7 @@ import data from './fixtures/data';
test('Can pass in custom endpoint', async t => {
const baseUrl = 'http://foo.com';
const defaultEndpoint = data.defaultEndpoints[0];
const onionoo = new Onionoo({baseUrl});
const onionoo = new Onionoo({ baseUrl });
const scope = nock(baseUrl)
.get(`/${defaultEndpoint}`)

2
test/cache.js

@ -33,7 +33,7 @@ test('Cache is disabled by default', async t => {
});
test('Cache options is passed through to Got', async t => {
const onionoo = new Onionoo({cache: new Map()});
const onionoo = new Onionoo({ cache: new Map() });
const defaultEndpoint = data.defaultEndpoints[0];
const responseHeaders = {

4
test/endpoints.js

@ -28,14 +28,14 @@ test('Can pass in custom endpoint array', t => {
'foo',
'bar'
];
const onionoo = new Onionoo({endpoints});
const onionoo = new Onionoo({ endpoints });
t.deepEqual(Object.keys(onionoo), endpoints);
});
test('Custom endpoint makes correct request', async t => {
const customEndpoint = 'foo';
const onionoo = new Onionoo({endpoints: [customEndpoint]});
const onionoo = new Onionoo({ endpoints: [customEndpoint] });
const scope = nock(data.defaultBaseUrl)
.get(`/${customEndpoint}`)

4
test/queries.js

@ -11,7 +11,7 @@ test('Query string is built correctly', async t => {
.get(`/${defaultEndpoint}?foo=bar`)
.reply(200, data.dummyResponse);
const response = await onionoo[defaultEndpoint]({foo: 'bar'});
const response = await onionoo[defaultEndpoint]({ foo: 'bar' });
t.deepEqual(response.body, data.dummyResponse);
t.true(scope.isDone());
@ -25,7 +25,7 @@ test('":" char isn\'t url encoded so filters work', async t => {
.get(`/${defaultEndpoint}?foo=key:value`)
.reply(200, data.dummyResponse);
const response = await onionoo[defaultEndpoint]({foo: 'key:value'});
const response = await onionoo[defaultEndpoint]({ foo: 'key:value' });
t.deepEqual(response.body, data.dummyResponse);
t.true(scope.isDone());

Loading…
Cancel
Save