Skip to content

Commit

Permalink
Merge pull request #8 from djMax/master
Browse files Browse the repository at this point in the history
Update tests to use 'real' errors
  • Loading branch information
thebigredgeek authored Sep 13, 2017
2 parents 94aef2a + e2dc894 commit 6bc6b83
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions test/unit/microlock_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,8 @@ describe('microlock', () => {
});
context('when unable to verify locked', () => {
beforeEach(() => {
etcd.__setErr = true;
etcd.__setErr = new Error();
etcd.__setErr.errorCode = 105;
});
it('returns a rejecting promise passing AlreadyLockedError', (done) => {
microlock.lock()
Expand Down Expand Up @@ -204,7 +205,7 @@ describe('microlock', () => {
context('when able to verify locked stat by current node', () => {
it('sets the state to locked with a refreshed ttl', () => {
microlock.renew();
expect(etcd.set.calledWith(key, node_id, {
expect(etcd.set.calledWith(key, null, {
ttl,
prevValue: node_id,
refresh: true
Expand All @@ -218,7 +219,8 @@ describe('microlock', () => {
});
context('when not able to verify locked state by current node', () => {
beforeEach(() => {
etcd.__setErr = true;
etcd.__setErr = new Error();
etcd.__setErr.errorCode = 101;
});
it('returns a rejecting promise passing LockNotOwnedError', (done) => {
microlock.renew()
Expand Down

0 comments on commit 6bc6b83

Please sign in to comment.