enrise-lock
Advanced tools
Comparing version 0.1.1 to 0.1.2
@@ -28,2 +28,4 @@ 'use strict'; | ||
this.owner = settings.owner; | ||
_.bindAll(this, _.keys(Lock.prototype)); | ||
} | ||
@@ -30,0 +32,0 @@ |
{ | ||
"name": "enrise-lock", | ||
"description": "Lock functionality used within Enrise projects and module's", | ||
"version": "0.1.1", | ||
"version": "0.1.2", | ||
"author": "Team MatchMinds @ Enrise", | ||
@@ -6,0 +6,0 @@ "main": "index.js", |
'use strict'; | ||
const _ = require('lodash'); | ||
const chai = require('chai'); | ||
@@ -64,2 +65,26 @@ const sinon = require('sinon'); | ||
it('binds all methods to the current scope', () => { | ||
const bindAll = _.bindAll; | ||
_.bindAll = sinon.stub(); | ||
const newLock = new Lock({ | ||
esClient: esClientStub, | ||
index: 'lock-index', | ||
type: 'lock-type', | ||
owner: 'unittest' | ||
}); | ||
expect(_.bindAll).to.have.been.calledWith(newLock, [ | ||
'acquire', | ||
'release', | ||
'isLocked', | ||
'list', | ||
'delete', | ||
'_acquireLock', | ||
'_releaseLock' | ||
]); | ||
_.bindAll = bindAll; | ||
}); | ||
describe('acquire and release functionality', () => { | ||
@@ -66,0 +91,0 @@ it('returns true when a lock for a resource is requested', (done) => { |
20535
421