diff --git a/.eslintrc b/.eslintrc index a2ef1df..32c1c3f 100644 --- a/.eslintrc +++ b/.eslintrc @@ -5,7 +5,7 @@ }, "parser": "babel-eslint", "parserOptions": { - "sourceType": "module" + "sourceType": "module" }, "extends": [ "plugin:@coorpacademy/coorpacademy/core", @@ -18,6 +18,16 @@ "@coorpacademy/coorpacademy" ], "rules": { - "promise/no-native": "off" - } + "promise/no-native": "off" + }, + "overrides": [ + { + "files": [ + "src/bin/*.js" + ], + "rules": { + "no-console": "off" + } + } + ] } diff --git a/package.json b/package.json index bb0c7d1..aa41835 100644 --- a/package.json +++ b/package.json @@ -12,9 +12,9 @@ "test:dev": "npm run lint && npm run ava", "lint": "eslint src/ *.js *.json --ext .js,.json", "lint:fix": "npm run lint -- --fix", - "ava": "NODE_ENV=test ava", + "ava": "ava", "ava:watch": "npm run ava -- --watch", - "nyc": "NODE_ENV=test nyc npm run test:dev", + "nyc": "nyc npm run test:dev", "coveralls": "nyc report --reporter=text-lcov | coveralls" }, "repository": { diff --git a/src/bin/dump.js b/src/bin/dump.js index fa72bb8..47204be 100755 --- a/src/bin/dump.js +++ b/src/bin/dump.js @@ -13,4 +13,4 @@ const namespace = argz._[1] || ''; const client = createEtcd(argz); const namespacedClient = client.namespace(namespace); -dump(namespacedClient, outDir).catch(console.error); // eslint-disable-line no-console +dump(namespacedClient, outDir).catch(console.error); diff --git a/src/bin/restore.js b/src/bin/restore.js index 0d5d16b..639d518 100644 --- a/src/bin/restore.js +++ b/src/bin/restore.js @@ -13,4 +13,4 @@ const namespace = argz._[1] || ''; const client = createEtcd(argz); const namespacedClient = client.namespace(namespace); -restore(namespacedClient, inDir).catch(console.error); // eslint-disable-line no-console +restore(namespacedClient, inDir).catch(console.error); diff --git a/src/bin/save.js b/src/bin/save.js index 6237529..94fda9f 100644 --- a/src/bin/save.js +++ b/src/bin/save.js @@ -12,4 +12,4 @@ const namespace = argz._[1] || ''; const client = createEtcd(argz); const namespacedClient = client.namespace(namespace); -save(namespacedClient, outDir).catch(console.error); // eslint-disable-line no-console +save(namespacedClient, outDir).catch(console.error); diff --git a/src/bin/watch.js b/src/bin/watch.js index 60865a8..1180221 100644 --- a/src/bin/watch.js +++ b/src/bin/watch.js @@ -16,11 +16,9 @@ const watch = async () => { .prefix('') .create(); - // eslint-disable-next-line no-console const putHandler = kv => console.log(`PUT ${kv.key.toString()} = ${kv.value.toString()}`); watcher.on('put', putHandler); - // eslint-disable-next-line no-console const delHandler = kv => console.log(`DEL ${kv.key.toString()}`); watcher.on('del', delHandler); @@ -35,4 +33,4 @@ const watch = async () => { return new Promise(resolve => watcher.once('end', resolve)); }; -watch().catch(console.error); // eslint-disable-line no-console +watch().catch(console.error); diff --git a/src/etcd/test/fetch.js b/src/etcd/test/fetch.js index 334af6d..1e1bde9 100644 --- a/src/etcd/test/fetch.js +++ b/src/etcd/test/fetch.js @@ -67,7 +67,16 @@ test('should retry on error', async t => { const fetch$ = createFetch$(client); - await t.notThrows(fetch$.toPromise()); + await t.deepEqual(await fetch$.toPromise(), { + type: 'fetch', + payload: [ + { + key: 'bar', + value: 'bar', + version: '1' + } + ] + }); client.unmock(); }); diff --git a/src/store/test/index.js b/src/store/test/index.js index 232c243..e3b655c 100644 --- a/src/store/test/index.js +++ b/src/store/test/index.js @@ -57,50 +57,3 @@ test('should return subscription', t => { t.true(subscription instanceof Subscription); }); - -// test('should', async t => { -// const records$ = Observable.of( -// { -// foo: { -// key: 'foo', -// value: 'foo', -// version: '1' -// } -// }, -// { -// bar: { -// key: 'bar', -// value: 'bar', -// version: '1' -// } -// } -// ); - -// const {store, subscription} = createStore(records$, []); - -// const [records, indexes] = await Promise.all([store('records'), store('indexes')]); -// t.deepEqual( -// records, -// new Map([ -// [ -// 'foo', -// { -// key: 'foo', -// value: 'foo', -// version: '1' -// } -// ], -// [ -// 'bar', -// { -// key: 'bar', -// value: 'bar', -// version: '1' -// } -// ] -// ]) -// ); -// t.deepEqual(indexes, new Map()); - -// subscription.unsubscribe(); -// }); diff --git a/src/test/index.js b/src/test/index.js index d0cccca..79632af 100644 --- a/src/test/index.js +++ b/src/test/index.js @@ -13,4 +13,5 @@ test('should accept fallback', t => { save: false }); t.truthy(squirrel); + squirrel.close(); });