mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
More tests for indexAll
This commit is contained in:
parent
cc818695ef
commit
3a700a5af2
1 changed files with 54 additions and 0 deletions
|
@ -234,6 +234,60 @@ describe 'ReferencesSearchHandler', ->
|
||||||
expect(data).to.equal @fakeResponseData
|
expect(data).to.equal @fakeResponseData
|
||||||
done()
|
done()
|
||||||
|
|
||||||
|
describe 'when Project.findPopulatedById produces an error', ->
|
||||||
|
|
||||||
|
beforeEach ->
|
||||||
|
@Project.findPopulatedById.callsArgWith(1, new Error('woops'))
|
||||||
|
|
||||||
|
it 'should produce an error', (done) ->
|
||||||
|
@call (err, data) =>
|
||||||
|
expect(err).to.not.equal null
|
||||||
|
expect(err).to.be.instanceof Error
|
||||||
|
expect(data).to.equal undefined
|
||||||
|
done()
|
||||||
|
|
||||||
|
it 'should not send request', (done) ->
|
||||||
|
@call (err, data) =>
|
||||||
|
@request.post.callCount.should.equal 0
|
||||||
|
done()
|
||||||
|
|
||||||
|
describe 'when _isFullIndex produces an error', ->
|
||||||
|
|
||||||
|
beforeEach ->
|
||||||
|
@Project.findPopulatedById.callsArgWith(1, null, @fakeProject)
|
||||||
|
@handler._isFullIndex.callsArgWith(1, new Error('woops'))
|
||||||
|
|
||||||
|
it 'should produce an error', (done) ->
|
||||||
|
@call (err, data) =>
|
||||||
|
expect(err).to.not.equal null
|
||||||
|
expect(err).to.be.instanceof Error
|
||||||
|
expect(data).to.equal undefined
|
||||||
|
done()
|
||||||
|
|
||||||
|
it 'should not send request', (done) ->
|
||||||
|
@call (err, data) =>
|
||||||
|
@request.post.callCount.should.equal 0
|
||||||
|
done()
|
||||||
|
|
||||||
|
describe 'when flushDocToMongo produces an error', ->
|
||||||
|
|
||||||
|
beforeEach ->
|
||||||
|
@Project.findPopulatedById.callsArgWith(1, null, @fakeProject)
|
||||||
|
@handler._isFullIndex.callsArgWith(1, false)
|
||||||
|
@DocumentUpdaterHandler.flushDocToMongo.callsArgWith(2, new Error('woops'))
|
||||||
|
|
||||||
|
it 'should produce an error', (done) ->
|
||||||
|
@call (err, data) =>
|
||||||
|
expect(err).to.not.equal null
|
||||||
|
expect(err).to.be.instanceof Error
|
||||||
|
expect(data).to.equal undefined
|
||||||
|
done()
|
||||||
|
|
||||||
|
it 'should not send request', (done) ->
|
||||||
|
@call (err, data) =>
|
||||||
|
@request.post.callCount.should.equal 0
|
||||||
|
done()
|
||||||
|
|
||||||
|
|
||||||
describe '_findBibDocIds', ->
|
describe '_findBibDocIds', ->
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue