mirror of
https://github.com/overleaf/overleaf.git
synced 2025-03-03 19:51:12 +00:00
add an acceptance test for flush with queue processing
This commit is contained in:
parent
b49621b3e9
commit
9f358ead9f
1 changed files with 35 additions and 1 deletions
|
@ -97,7 +97,41 @@ describe "Deleting a project", ->
|
|||
it "should flush each doc in project history", ->
|
||||
MockProjectHistoryApi.flushProject.calledWith(@project_id).should.equal true
|
||||
|
||||
describe "with the background=true parameter from realtime", ->
|
||||
describe "with the background=true parameter from realtime and no request to flush the queue", ->
|
||||
before (done) ->
|
||||
sinon.spy MockWebApi, "setDocument"
|
||||
sinon.spy MockTrackChangesApi, "flushDoc"
|
||||
sinon.spy MockProjectHistoryApi, "flushProject"
|
||||
|
||||
async.series @docs.map((doc) =>
|
||||
(callback) =>
|
||||
DocUpdaterClient.preloadDoc @project_id, doc.id, callback
|
||||
), (error) =>
|
||||
throw error if error?
|
||||
setTimeout () =>
|
||||
DocUpdaterClient.deleteProjectOnShutdown @project_id, (error, res, body) =>
|
||||
@statusCode = res.statusCode
|
||||
done()
|
||||
, 200
|
||||
|
||||
after ->
|
||||
MockWebApi.setDocument.restore()
|
||||
MockTrackChangesApi.flushDoc.restore()
|
||||
MockProjectHistoryApi.flushProject.restore()
|
||||
|
||||
it "should return a 204 status code", ->
|
||||
@statusCode.should.equal 204
|
||||
|
||||
it "should not send any documents to the web api", ->
|
||||
MockWebApi.setDocument.called.should.equal false
|
||||
|
||||
it "should not flush any docs in track changes", ->
|
||||
MockTrackChangesApi.flushDoc.called.should.equal false
|
||||
|
||||
it "should not flush to project history", ->
|
||||
MockProjectHistoryApi.flushProject.called.should.equal false
|
||||
|
||||
describe "with the background=true parameter from realtime and a request to flush the queue", ->
|
||||
before (done) ->
|
||||
sinon.spy MockWebApi, "setDocument"
|
||||
sinon.spy MockTrackChangesApi, "flushDoc"
|
||||
|
|
Loading…
Reference in a new issue