mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Add unit tests for failing history API
This commit is contained in:
parent
217940d76f
commit
5987d6d79c
1 changed files with 17 additions and 0 deletions
|
@ -182,3 +182,20 @@ describe "HistoryController", ->
|
|||
|
||||
it "should return the data with users to the client", ->
|
||||
@res.json.calledWith(@data_with_users).should.equal true
|
||||
|
||||
describe "proxyToHistoryApiAndInjectUserDetails (with the history API failing)", ->
|
||||
beforeEach ->
|
||||
@req = { url: "/mock/url", method: "POST", useProjectHistory: true }
|
||||
@res = { json: sinon.stub() }
|
||||
@next = sinon.stub()
|
||||
@request.yields(null, {statusCode: 500}, @data = "mock-data")
|
||||
@HistoryManager.injectUserDetails = sinon.stub().yields(null, @data_with_users = "mock-injected-data")
|
||||
@HistoryController.proxyToHistoryApiAndInjectUserDetails @req, @res, @next
|
||||
|
||||
it "should not inject the user data", ->
|
||||
@HistoryManager.injectUserDetails
|
||||
.calledWith(@data)
|
||||
.should.equal false
|
||||
|
||||
it "should not return the data with users to the client", ->
|
||||
@res.json.calledWith(@data_with_users).should.equal false
|
||||
|
|
Loading…
Reference in a new issue