mirror of
https://github.com/overleaf/overleaf.git
synced 2025-04-15 06:56:57 +00:00
Upgrade Sinon
This commit is contained in:
parent
759d385be8
commit
65fe74fd2d
19 changed files with 404 additions and 276 deletions
445
services/document-updater/package-lock.json
generated
445
services/document-updater/package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -55,7 +55,7 @@
|
|||
"prettier": "^2.0.5",
|
||||
"prettier-eslint-cli": "^5.0.0",
|
||||
"sandboxed-module": "~0.2.0",
|
||||
"sinon": "~1.5.2",
|
||||
"sinon": "^9.0.2",
|
||||
"timekeeper": "^2.0.0"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -121,26 +121,26 @@ describe('Flushing a doc to Mongo', function () {
|
|||
version: this.version
|
||||
})
|
||||
let t = 30000
|
||||
sinon.stub(
|
||||
MockWebApi,
|
||||
'setDocument',
|
||||
(
|
||||
project_id,
|
||||
doc_id,
|
||||
lines,
|
||||
version,
|
||||
ranges,
|
||||
lastUpdatedAt,
|
||||
lastUpdatedBy,
|
||||
callback
|
||||
) => {
|
||||
if (callback == null) {
|
||||
callback = function (error) {}
|
||||
sinon
|
||||
.stub(MockWebApi, 'setDocument')
|
||||
.callsFake(
|
||||
(
|
||||
project_id,
|
||||
doc_id,
|
||||
lines,
|
||||
version,
|
||||
ranges,
|
||||
lastUpdatedAt,
|
||||
lastUpdatedBy,
|
||||
callback
|
||||
) => {
|
||||
if (callback == null) {
|
||||
callback = function (error) {}
|
||||
}
|
||||
setTimeout(callback, t)
|
||||
return (t = 0)
|
||||
}
|
||||
setTimeout(callback, t)
|
||||
return (t = 0)
|
||||
}
|
||||
)
|
||||
)
|
||||
return DocUpdaterClient.preloadDoc(this.project_id, this.doc_id, done)
|
||||
})
|
||||
|
||||
|
|
|
@ -216,12 +216,14 @@ describe('Getting a document', function () {
|
|||
DocUpdaterClient.randomId(),
|
||||
DocUpdaterClient.randomId()
|
||||
])
|
||||
sinon.stub(MockWebApi, 'getDocument', (project_id, doc_id, callback) => {
|
||||
if (callback == null) {
|
||||
callback = function (error, doc) {}
|
||||
}
|
||||
return callback(new Error('oops'))
|
||||
})
|
||||
sinon
|
||||
.stub(MockWebApi, 'getDocument')
|
||||
.callsFake((project_id, doc_id, callback) => {
|
||||
if (callback == null) {
|
||||
callback = function (error, doc) {}
|
||||
}
|
||||
return callback(new Error('oops'))
|
||||
})
|
||||
return DocUpdaterClient.getDoc(
|
||||
this.project_id,
|
||||
this.doc_id,
|
||||
|
@ -248,12 +250,14 @@ describe('Getting a document', function () {
|
|||
DocUpdaterClient.randomId(),
|
||||
DocUpdaterClient.randomId()
|
||||
])
|
||||
sinon.stub(MockWebApi, 'getDocument', (project_id, doc_id, callback) => {
|
||||
if (callback == null) {
|
||||
callback = function (error, doc) {}
|
||||
}
|
||||
return setTimeout(callback, 30000)
|
||||
})
|
||||
sinon
|
||||
.stub(MockWebApi, 'getDocument')
|
||||
.callsFake((project_id, doc_id, callback) => {
|
||||
if (callback == null) {
|
||||
callback = function (error, doc) {}
|
||||
}
|
||||
return setTimeout(callback, 30000)
|
||||
})
|
||||
return done()
|
||||
})
|
||||
|
||||
|
|
|
@ -88,9 +88,9 @@ describe('Setting a document', function () {
|
|||
})
|
||||
|
||||
after(function () {
|
||||
MockTrackChangesApi.flushDoc.reset()
|
||||
MockProjectHistoryApi.flushProject.reset()
|
||||
MockWebApi.setDocument.reset()
|
||||
MockTrackChangesApi.flushDoc.resetHistory()
|
||||
MockProjectHistoryApi.flushProject.resetHistory()
|
||||
MockWebApi.setDocument.resetHistory()
|
||||
})
|
||||
|
||||
it('should return a 204 status code', function () {
|
||||
|
@ -171,9 +171,9 @@ describe('Setting a document', function () {
|
|||
})
|
||||
|
||||
after(function () {
|
||||
MockTrackChangesApi.flushDoc.reset()
|
||||
MockProjectHistoryApi.flushProject.reset()
|
||||
MockWebApi.setDocument.reset()
|
||||
MockTrackChangesApi.flushDoc.resetHistory()
|
||||
MockProjectHistoryApi.flushProject.resetHistory()
|
||||
MockWebApi.setDocument.resetHistory()
|
||||
})
|
||||
|
||||
it('should return a 204 status code', function () {
|
||||
|
@ -254,9 +254,9 @@ describe('Setting a document', function () {
|
|||
})
|
||||
|
||||
after(function () {
|
||||
MockTrackChangesApi.flushDoc.reset()
|
||||
MockProjectHistoryApi.flushProject.reset()
|
||||
MockWebApi.setDocument.reset()
|
||||
MockTrackChangesApi.flushDoc.resetHistory()
|
||||
MockProjectHistoryApi.flushProject.resetHistory()
|
||||
MockWebApi.setDocument.resetHistory()
|
||||
})
|
||||
|
||||
it(`should return a ${testCase.expectedStatusCode} status code`, function () {
|
||||
|
@ -310,9 +310,9 @@ describe('Setting a document', function () {
|
|||
})
|
||||
|
||||
after(function () {
|
||||
MockTrackChangesApi.flushDoc.reset()
|
||||
MockProjectHistoryApi.flushProject.reset()
|
||||
MockWebApi.setDocument.reset()
|
||||
MockTrackChangesApi.flushDoc.resetHistory()
|
||||
MockProjectHistoryApi.flushProject.resetHistory()
|
||||
MockWebApi.setDocument.resetHistory()
|
||||
})
|
||||
|
||||
it('should return a 204 status code', function () {
|
||||
|
@ -388,9 +388,9 @@ describe('Setting a document', function () {
|
|||
})
|
||||
|
||||
after(function () {
|
||||
MockTrackChangesApi.flushDoc.reset()
|
||||
MockProjectHistoryApi.flushProject.reset()
|
||||
MockWebApi.setDocument.reset()
|
||||
MockTrackChangesApi.flushDoc.resetHistory()
|
||||
MockProjectHistoryApi.flushProject.resetHistory()
|
||||
MockWebApi.setDocument.resetHistory()
|
||||
})
|
||||
|
||||
it('should undo the tracked changes', function (done) {
|
||||
|
@ -451,9 +451,9 @@ describe('Setting a document', function () {
|
|||
})
|
||||
|
||||
after(function () {
|
||||
MockTrackChangesApi.flushDoc.reset()
|
||||
MockProjectHistoryApi.flushProject.reset()
|
||||
MockWebApi.setDocument.reset()
|
||||
MockTrackChangesApi.flushDoc.resetHistory()
|
||||
MockProjectHistoryApi.flushProject.resetHistory()
|
||||
MockWebApi.setDocument.resetHistory()
|
||||
})
|
||||
|
||||
it('should not undo the tracked changes', function (done) {
|
||||
|
|
|
@ -52,7 +52,8 @@ describe('DocumentManager', function () {
|
|||
'./RealTimeRedisManager': (this.RealTimeRedisManager = {}),
|
||||
'./DiffCodec': (this.DiffCodec = {}),
|
||||
'./UpdateManager': (this.UpdateManager = {}),
|
||||
'./RangesManager': (this.RangesManager = {})
|
||||
'./RangesManager': (this.RangesManager = {}),
|
||||
'./Errors': Errors
|
||||
}
|
||||
})
|
||||
this.project_id = 'project-id-123'
|
||||
|
@ -765,10 +766,9 @@ describe('DocumentManager', function () {
|
|||
})
|
||||
|
||||
return it('should call the callback with a not found error', function () {
|
||||
const error = new Errors.NotFoundError(
|
||||
`document not found: ${this.doc_id}`
|
||||
)
|
||||
return this.callback.calledWith(error).should.equal(true)
|
||||
return this.callback
|
||||
.calledWith(sinon.match.instanceOf(Errors.NotFoundError))
|
||||
.should.equal(true)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
@ -848,10 +848,9 @@ describe('DocumentManager', function () {
|
|||
})
|
||||
|
||||
return it('should call the callback with a not found error', function () {
|
||||
const error = new Errors.NotFoundError(
|
||||
`document not found: ${this.doc_id}`
|
||||
)
|
||||
return this.callback.calledWith(error).should.equal(true)
|
||||
return this.callback
|
||||
.calledWith(sinon.match.instanceOf(Errors.NotFoundError))
|
||||
.should.equal(true)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
|
@ -95,7 +95,7 @@ describe('HistoryRedisManager', function () {
|
|||
|
||||
return it('should call the callback with an error', function () {
|
||||
return this.callback
|
||||
.calledWith(new Error('cannot push no ops'))
|
||||
.calledWith(sinon.match.instanceOf(Error))
|
||||
.should.equal(true)
|
||||
})
|
||||
})
|
||||
|
|
|
@ -159,7 +159,7 @@ describe('HttpController', function () {
|
|||
|
||||
it('should call next with NotFoundError', function () {
|
||||
this.next
|
||||
.calledWith(new Errors.NotFoundError('not found'))
|
||||
.calledWith(sinon.match.instanceOf(Errors.NotFoundError))
|
||||
.should.equal(true)
|
||||
})
|
||||
})
|
||||
|
@ -173,7 +173,7 @@ describe('HttpController', function () {
|
|||
})
|
||||
|
||||
it('should call next with the error', function () {
|
||||
this.next.calledWith(new Error('oops')).should.equal(true)
|
||||
this.next.calledWith(sinon.match.instanceOf(Error)).should.equal(true)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
@ -252,7 +252,7 @@ describe('HttpController', function () {
|
|||
})
|
||||
|
||||
it('should call next with the error', function () {
|
||||
this.next.calledWith(new Error('oops')).should.equal(true)
|
||||
this.next.calledWith(sinon.match.instanceOf(Error)).should.equal(true)
|
||||
})
|
||||
})
|
||||
|
||||
|
@ -327,7 +327,7 @@ describe('HttpController', function () {
|
|||
})
|
||||
|
||||
it('should call next with the error', function () {
|
||||
this.next.calledWith(new Error('oops')).should.equal(true)
|
||||
this.next.calledWith(sinon.match.instanceOf(Error)).should.equal(true)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
@ -387,7 +387,7 @@ describe('HttpController', function () {
|
|||
})
|
||||
|
||||
it('should call next with the error', function () {
|
||||
this.next.calledWith(new Error('oops')).should.equal(true)
|
||||
this.next.calledWith(sinon.match.instanceOf(Error)).should.equal(true)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
@ -477,7 +477,7 @@ describe('HttpController', function () {
|
|||
})
|
||||
|
||||
it('should call next with the error', function () {
|
||||
this.next.calledWith(new Error('oops')).should.equal(true)
|
||||
this.next.calledWith(sinon.match.instanceOf(Error)).should.equal(true)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
@ -550,7 +550,7 @@ describe('HttpController', function () {
|
|||
})
|
||||
|
||||
it('should call next with the error', function () {
|
||||
this.next.calledWith(new Error('oops')).should.equal(true)
|
||||
this.next.calledWith(sinon.match.instanceOf(Error)).should.equal(true)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
@ -640,7 +640,7 @@ describe('HttpController', function () {
|
|||
})
|
||||
|
||||
it('should call next with the error', function () {
|
||||
this.next.calledWith(new Error('oops')).should.equal(true)
|
||||
this.next.calledWith(sinon.match.instanceOf(Error)).should.equal(true)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
@ -703,7 +703,7 @@ describe('HttpController', function () {
|
|||
})
|
||||
|
||||
it('should call next with the error', function () {
|
||||
this.next.calledWith(new Error('oops')).should.equal(true)
|
||||
this.next.calledWith(sinon.match.instanceOf(Error)).should.equal(true)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
@ -804,7 +804,7 @@ describe('HttpController', function () {
|
|||
})
|
||||
|
||||
it('should call next with the error', function () {
|
||||
this.next.calledWith(new Error('oops')).should.equal(true)
|
||||
this.next.calledWith(sinon.match.instanceOf(Error)).should.equal(true)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
@ -870,7 +870,7 @@ describe('HttpController', function () {
|
|||
})
|
||||
|
||||
it('should call next with the error', function () {
|
||||
this.next.calledWith(new Error('oops')).should.equal(true)
|
||||
this.next.calledWith(sinon.match.instanceOf(Error)).should.equal(true)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
@ -925,7 +925,7 @@ describe('HttpController', function () {
|
|||
})
|
||||
|
||||
it('should call next with the error', function () {
|
||||
this.next.calledWith(new Error('oops')).should.equal(true)
|
||||
this.next.calledWith(sinon.match.instanceOf(Error)).should.equal(true)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
|
@ -92,7 +92,7 @@ describe('LockManager - releasing the lock', function () {
|
|||
|
||||
return it('should return an error if the lock has expired', function () {
|
||||
return this.callback
|
||||
.calledWith(new Error('tried to release timed out lock'))
|
||||
.calledWith(sinon.match.instanceOf(Error))
|
||||
.should.equal(true)
|
||||
})
|
||||
})
|
||||
|
|
|
@ -119,9 +119,13 @@ describe('LockManager - getting the lock', function () {
|
|||
})
|
||||
|
||||
return it('should return the callback with an error', function () {
|
||||
const e = new Error('Timeout')
|
||||
e.doc_id = this.doc_id
|
||||
return this.callback.calledWith(e).should.equal(true)
|
||||
return this.callback
|
||||
.calledWith(
|
||||
sinon.match
|
||||
.instanceOf(Error)
|
||||
.and(sinon.match.has('doc_id', this.doc_id))
|
||||
)
|
||||
.should.equal(true)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
|
@ -142,8 +142,9 @@ describe('LockManager - trying the lock', function () {
|
|||
})
|
||||
|
||||
return it('should return the callback with an error', function () {
|
||||
const e = new Error('tried to release timed out lock')
|
||||
return this.callback.calledWith(e).should.equal(true)
|
||||
return this.callback
|
||||
.calledWith(sinon.match.instanceOf(Error))
|
||||
.should.equal(true)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
|
@ -41,7 +41,8 @@ describe('PersistenceManager', function () {
|
|||
'logger-sharelatex': (this.logger = {
|
||||
log: sinon.stub(),
|
||||
err: sinon.stub()
|
||||
})
|
||||
}),
|
||||
'./Errors': Errors
|
||||
}
|
||||
})
|
||||
this.project_id = 'project-id-123'
|
||||
|
@ -171,7 +172,7 @@ describe('PersistenceManager', function () {
|
|||
|
||||
it('should return a NotFoundError', function () {
|
||||
return this.callback
|
||||
.calledWith(new Errors.NotFoundError('not found'))
|
||||
.calledWith(sinon.match.instanceOf(Errors.NotFoundError))
|
||||
.should.equal(true)
|
||||
})
|
||||
|
||||
|
@ -198,7 +199,7 @@ describe('PersistenceManager', function () {
|
|||
|
||||
it('should return an error', function () {
|
||||
return this.callback
|
||||
.calledWith(new Error('web api error'))
|
||||
.calledWith(sinon.match.instanceOf(Error))
|
||||
.should.equal(true)
|
||||
})
|
||||
|
||||
|
@ -231,7 +232,7 @@ describe('PersistenceManager', function () {
|
|||
|
||||
return it('should return and error', function () {
|
||||
return this.callback
|
||||
.calledWith(new Error('web API response had no doc lines'))
|
||||
.calledWith(sinon.match.instanceOf(Error))
|
||||
.should.equal(true)
|
||||
})
|
||||
})
|
||||
|
@ -254,7 +255,7 @@ describe('PersistenceManager', function () {
|
|||
|
||||
return it('should return and error', function () {
|
||||
return this.callback
|
||||
.calledWith(new Error('web API response had no valid doc version'))
|
||||
.calledWith(sinon.match.instanceOf(Error))
|
||||
.should.equal(true)
|
||||
})
|
||||
})
|
||||
|
@ -277,7 +278,7 @@ describe('PersistenceManager', function () {
|
|||
|
||||
return it('should return and error', function () {
|
||||
return this.callback
|
||||
.calledWith(new Error('web API response had no valid doc pathname'))
|
||||
.calledWith(sinon.match.instanceOf(Error))
|
||||
.should.equal(true)
|
||||
})
|
||||
})
|
||||
|
@ -386,7 +387,7 @@ describe('PersistenceManager', function () {
|
|||
|
||||
it('should return a NotFoundError', function () {
|
||||
return this.callback
|
||||
.calledWith(new Errors.NotFoundError('not found'))
|
||||
.calledWith(sinon.match.instanceOf(Errors.NotFoundError))
|
||||
.should.equal(true)
|
||||
})
|
||||
|
||||
|
@ -418,7 +419,7 @@ describe('PersistenceManager', function () {
|
|||
|
||||
it('should return an error', function () {
|
||||
return this.callback
|
||||
.calledWith(new Error('web api error'))
|
||||
.calledWith(sinon.match.instanceOf(Error))
|
||||
.should.equal(true)
|
||||
})
|
||||
|
||||
|
|
|
@ -147,7 +147,9 @@ describe('ProjectManager - flushAndDeleteProject', function () {
|
|||
})
|
||||
|
||||
it('should call the callback with an error', function () {
|
||||
return this.callback.calledWith(new Error()).should.equal(true)
|
||||
return this.callback
|
||||
.calledWith(sinon.match.instanceOf(Error))
|
||||
.should.equal(true)
|
||||
})
|
||||
|
||||
return it('should time the execution', function () {
|
||||
|
|
|
@ -136,7 +136,9 @@ describe('ProjectManager - flushProject', function () {
|
|||
})
|
||||
|
||||
it('should call the callback with an error', function () {
|
||||
return this.callback.calledWith(new Error()).should.equal(true)
|
||||
return this.callback
|
||||
.calledWith(sinon.match.instanceOf(Error))
|
||||
.should.equal(true)
|
||||
})
|
||||
|
||||
return it('should time the execution', function () {
|
||||
|
|
|
@ -40,7 +40,8 @@ describe('ProjectManager - getProjectDocsAndFlushIfOld', function () {
|
|||
Timer.initClass()
|
||||
return Timer
|
||||
})())
|
||||
})
|
||||
}),
|
||||
'./Errors': Errors
|
||||
}
|
||||
})
|
||||
this.project_id = 'project-id-123'
|
||||
|
@ -146,9 +147,7 @@ describe('ProjectManager - getProjectDocsAndFlushIfOld', function () {
|
|||
|
||||
it('should call the callback with an error', function () {
|
||||
return this.callback
|
||||
.calledWith(
|
||||
new Errors.ProjectStateChangedError('project state changed')
|
||||
)
|
||||
.calledWith(sinon.match.instanceOf(Errors.ProjectStateChangedError))
|
||||
.should.equal(true)
|
||||
})
|
||||
|
||||
|
@ -194,7 +193,9 @@ describe('ProjectManager - getProjectDocsAndFlushIfOld', function () {
|
|||
})
|
||||
|
||||
it('should call the callback with an error', function () {
|
||||
return this.callback.calledWith(new Error('oops')).should.equal(true)
|
||||
return this.callback
|
||||
.calledWith(sinon.match.instanceOf(Error))
|
||||
.should.equal(true)
|
||||
})
|
||||
|
||||
return it('should time the execution', function () {
|
||||
|
|
|
@ -118,7 +118,7 @@ describe('RealTimeRedisManager', function () {
|
|||
|
||||
return it('should return an error to the callback', function () {
|
||||
return this.callback
|
||||
.calledWith(new Error('JSON parse error'))
|
||||
.calledWith(sinon.match.has('name', 'SyntaxError'))
|
||||
.should.equal(true)
|
||||
})
|
||||
})
|
||||
|
|
|
@ -398,7 +398,7 @@ describe('RedisManager', function () {
|
|||
|
||||
return it('should return an error', function () {
|
||||
return this.callback
|
||||
.calledWith(new Error('redis getDoc exceeded timeout'))
|
||||
.calledWith(sinon.match.instanceOf(Error))
|
||||
.should.equal(true)
|
||||
})
|
||||
})
|
||||
|
@ -426,7 +426,7 @@ describe('RedisManager', function () {
|
|||
|
||||
return it('should return an error', function () {
|
||||
return this.callback
|
||||
.calledWith(new Errors.NotFoundError('not found'))
|
||||
.calledWith(sinon.match.instanceOf(Errors.NotFoundError))
|
||||
.should.equal(true)
|
||||
})
|
||||
})
|
||||
|
@ -543,11 +543,7 @@ describe('RedisManager', function () {
|
|||
|
||||
it('should return an error', function () {
|
||||
return this.callback
|
||||
.calledWith(
|
||||
new Errors.OpRangeNotAvailableError(
|
||||
'doc ops range is not loaded in redis'
|
||||
)
|
||||
)
|
||||
.calledWith(sinon.match.instanceOf(Errors.OpRangeNotAvailableError))
|
||||
.should.equal(true)
|
||||
})
|
||||
|
||||
|
@ -588,7 +584,7 @@ describe('RedisManager', function () {
|
|||
|
||||
return it('should return an error', function () {
|
||||
return this.callback
|
||||
.calledWith(new Error('redis getPreviousDocOps exceeded timeout'))
|
||||
.calledWith(sinon.match.instanceOf(Error))
|
||||
.should.equal(true)
|
||||
})
|
||||
})
|
||||
|
@ -854,9 +850,7 @@ describe('RedisManager', function () {
|
|||
|
||||
return it('should call the callback with an error', function () {
|
||||
return this.callback
|
||||
.calledWith(
|
||||
new Error(`Version mismatch. '${this.doc_id}' is corrupted.`)
|
||||
)
|
||||
.calledWith(sinon.match.instanceOf(Error))
|
||||
.should.equal(true)
|
||||
})
|
||||
})
|
||||
|
@ -954,7 +948,7 @@ describe('RedisManager', function () {
|
|||
|
||||
return it('should call the callback with an error', function () {
|
||||
return this.callback
|
||||
.calledWith(new Error('null bytes found in doc lines'))
|
||||
.calledWith(sinon.match.instanceOf(Error))
|
||||
.should.equal(true)
|
||||
})
|
||||
})
|
||||
|
@ -985,7 +979,7 @@ describe('RedisManager', function () {
|
|||
|
||||
return it('should call the callback with the error', function () {
|
||||
return this.callback
|
||||
.calledWith(new Error('ranges are too large'))
|
||||
.calledWith(sinon.match.instanceOf(Error))
|
||||
.should.equal(true)
|
||||
})
|
||||
})
|
||||
|
@ -1157,7 +1151,7 @@ describe('RedisManager', function () {
|
|||
|
||||
return it('should call the callback with an error', function () {
|
||||
return this.callback
|
||||
.calledWith(new Error('null bytes found in doc lines'))
|
||||
.calledWith(sinon.match.instanceOf(Error))
|
||||
.should.equal(true)
|
||||
})
|
||||
})
|
||||
|
@ -1185,7 +1179,7 @@ describe('RedisManager', function () {
|
|||
|
||||
return it('should call the callback with the error', function () {
|
||||
return this.callback
|
||||
.calledWith(new Error('ranges are too large'))
|
||||
.calledWith(sinon.match.instanceOf(Error))
|
||||
.should.equal(true)
|
||||
})
|
||||
})
|
||||
|
|
|
@ -26,7 +26,8 @@ describe('ShareJsDB', function () {
|
|||
this.callback = sinon.stub()
|
||||
this.ShareJsDB = SandboxedModule.require(modulePath, {
|
||||
requires: {
|
||||
'./RedisManager': (this.RedisManager = {})
|
||||
'./RedisManager': (this.RedisManager = {}),
|
||||
'./Errors': Errors
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -68,7 +69,7 @@ describe('ShareJsDB', function () {
|
|||
|
||||
return it('should return the callback with a NotFoundError', function () {
|
||||
return this.callback
|
||||
.calledWith(new Errors.NotFoundError('not found'))
|
||||
.calledWith(sinon.match.instanceOf(Errors.NotFoundError))
|
||||
.should.equal(true)
|
||||
})
|
||||
})
|
||||
|
|
|
@ -194,7 +194,9 @@ describe('ShareJsUpdateManager', function () {
|
|||
})
|
||||
|
||||
return it('should call the callback with the error', function () {
|
||||
return this.callback.calledWith(this.error).should.equal(true)
|
||||
return this.callback
|
||||
.calledWith(sinon.match.instanceOf(Error))
|
||||
.should.equal(true)
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Add table
Reference in a new issue