Skip to content

Commit

Permalink
Review
Browse files Browse the repository at this point in the history
  • Loading branch information
godu committed Feb 14, 2018
1 parent 12e8827 commit 1ac16d3
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 59 deletions.
16 changes: 13 additions & 3 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
},
"parser": "babel-eslint",
"parserOptions": {
"sourceType": "module"
"sourceType": "module"
},
"extends": [
"plugin:@coorpacademy/coorpacademy/core",
Expand All @@ -18,6 +18,16 @@
"@coorpacademy/coorpacademy"
],
"rules": {
"promise/no-native": "off"
}
"promise/no-native": "off"
},
"overrides": [
{
"files": [
"src/bin/*.js"
],
"rules": {
"no-console": "off"
}
}
]
}
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
2 changes: 1 addition & 1 deletion src/bin/dump.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
2 changes: 1 addition & 1 deletion src/bin/restore.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
2 changes: 1 addition & 1 deletion src/bin/save.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
4 changes: 1 addition & 3 deletions src/bin/watch.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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);
11 changes: 10 additions & 1 deletion src/etcd/test/fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
47 changes: 0 additions & 47 deletions src/store/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
// });
1 change: 1 addition & 0 deletions src/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ test('should accept fallback', t => {
save: false
});
t.truthy(squirrel);
squirrel.close();
});

0 comments on commit 1ac16d3

Please sign in to comment.