Skip to content

Commit 6bc6b83

Browse files
Merge pull request #8 from djMax/master
Update tests to use 'real' errors
2 parents 94aef2a + e2dc894 commit 6bc6b83

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

test/unit/microlock_spec.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,8 @@ describe('microlock', () => {
171171
});
172172
context('when unable to verify locked', () => {
173173
beforeEach(() => {
174-
etcd.__setErr = true;
174+
etcd.__setErr = new Error();
175+
etcd.__setErr.errorCode = 105;
175176
});
176177
it('returns a rejecting promise passing AlreadyLockedError', (done) => {
177178
microlock.lock()
@@ -204,7 +205,7 @@ describe('microlock', () => {
204205
context('when able to verify locked stat by current node', () => {
205206
it('sets the state to locked with a refreshed ttl', () => {
206207
microlock.renew();
207-
expect(etcd.set.calledWith(key, node_id, {
208+
expect(etcd.set.calledWith(key, null, {
208209
ttl,
209210
prevValue: node_id,
210211
refresh: true
@@ -218,7 +219,8 @@ describe('microlock', () => {
218219
});
219220
context('when not able to verify locked state by current node', () => {
220221
beforeEach(() => {
221-
etcd.__setErr = true;
222+
etcd.__setErr = new Error();
223+
etcd.__setErr.errorCode = 101;
222224
});
223225
it('returns a rejecting promise passing LockNotOwnedError', (done) => {
224226
microlock.renew()

0 commit comments

Comments
 (0)