Skip to content

Commit

Permalink
Removes etcd helper
Browse files Browse the repository at this point in the history
  • Loading branch information
travis-ci committed Jul 4, 2016
1 parent 17b5dc0 commit 61e68ff
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 55 deletions.
27 changes: 16 additions & 11 deletions src/test/fetch.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import test from 'ava';
import {pipe, fill, map, concat} from 'lodash/fp';

import createEtcd from './helpers/etcd';
import createFetch$ from '../fetch';

import emptyRoot from './fixtures/empty-root';

test('should fetch nodes', t => {
const client = createEtcd({
get: [[null, emptyRoot]]
});
const getMocks = [[null, emptyRoot]];

const client = {
get: (cwd, options, cb) => cb(...getMocks.shift())
};

const fetch$ = createFetch$(client, '/');

const expected = [emptyRoot];
Expand All @@ -25,13 +27,16 @@ test('should fetch nodes', t => {
});

test('should retry on error', t => {
const client = createEtcd({
get: pipe(
fill(new Error),
map(err => [err]),
concat([[null, emptyRoot]])
)(Array(10))
});
const getMocks = pipe(
fill(new Error),
map(err => [err]),
concat([[null, emptyRoot]])
)(Array(10));

const client = {
get: (cwd, options, cb) => cb(...getMocks.shift())
};

const fetch$ = createFetch$(client, '/');

return new Promise((resolve, reject) => {
Expand Down
23 changes: 0 additions & 23 deletions src/test/helpers/etcd.js

This file was deleted.

45 changes: 24 additions & 21 deletions src/test/resync.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
import test from 'ava';
import {Observable} from 'rxjs';

import createEtcd from './helpers/etcd';
import createResyncer$ from '../resync';

import setEvent from './fixtures/set-event';
import resyncEvent from './fixtures/resync-event';

test('should transform resync event', async t => {
const client = createEtcd({
get: [[null, {
action: 'get',
node: {
key: '/',
dir: true,
nodes: [setEvent.node]
}
}]]
});
const getMocks = [[null, {
action: 'get',
node: {
key: '/',
dir: true,
nodes: [setEvent.node]
}
}]];

const client = {
get: (cwd, options, cb) => cb(...getMocks.shift())
};

const events$ = Observable.of(resyncEvent);

Expand All @@ -37,16 +38,18 @@ test('should transform resync event', async t => {
});

test('should keep order', async t => {
const client = createEtcd({
get: [[null, {
action: 'get',
node: {
key: '/',
dir: true,
nodes: [setEvent.node]
}
}]]
});
const getMocks = [[null, {
action: 'get',
node: {
key: '/',
dir: true,
nodes: [setEvent.node]
}
}]];

const client = {
get: (cwd, options, cb) => cb(...getMocks.shift())
};

const events$ = Observable.of(setEvent, resyncEvent, setEvent);

Expand Down

0 comments on commit 61e68ff

Please sign in to comment.