Skip to content

Commit

Permalink
fix unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
T1B0 committed Jan 12, 2017
1 parent 32042a9 commit 686ef1a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
7 changes: 1 addition & 6 deletions src/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,7 @@ const createAPI = (store, client, options = {cwd: '/'}) => {
const del = _path => {
const fullPath = join(options.cwd, _path);
debug(`del => ${fullPath}`);
return del$(client, fullPath)
.map(x => {
debug('DEL$', fullPath, x);
return x;
})
.toPromise();
return del$(client, fullPath).toPromise();
};

return {
Expand Down
12 changes: 10 additions & 2 deletions src/test/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,17 @@ test('should get null if no complex index matches (raw)', async t => {
});

test('should delete node if it match (del)', async t => {
const client = createEtcdMock({
del: [{
assert: p => Promise.resolve(true),
values: [null, null, null]
}]
});
const _api = createAPI(getStore, client);

t.deepEqual(
await api.del('/bim/bam'),
true
await _api.del('/bim'),
null
);
});

Expand Down

0 comments on commit 686ef1a

Please sign in to comment.