mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
added unit tests for ProjectEntityHandler
This commit is contained in:
parent
f9617034be
commit
0347abb13a
1 changed files with 35 additions and 0 deletions
|
@ -781,6 +781,41 @@ describe 'ProjectEntityHandler', ->
|
|||
})
|
||||
.should.equal true
|
||||
|
||||
describe "getAllFoldersFromProject", ->
|
||||
beforeEach ->
|
||||
@callback = sinon.stub()
|
||||
@ProjectEntityHandler.getAllFoldersFromProject @project, @callback
|
||||
|
||||
it "should call the callback with the folders", ->
|
||||
@callback
|
||||
.calledWith(null, {
|
||||
"/": @project.rootFolder[0]
|
||||
"/folder1": @folder1
|
||||
})
|
||||
.should.equal true
|
||||
|
||||
describe "getAllDocPathsFromProject", ->
|
||||
beforeEach ->
|
||||
@docs = [{
|
||||
_id: @doc1._id
|
||||
lines: @lines1 = ["one"]
|
||||
rev: @rev1 = 1
|
||||
}, {
|
||||
_id: @doc2._id
|
||||
lines: @lines2 = ["two"]
|
||||
rev: @rev2 = 2
|
||||
}]
|
||||
@callback = sinon.stub()
|
||||
@ProjectEntityHandler.getAllDocPathsFromProject @project, @callback
|
||||
|
||||
it "should call the callback with the path for each doc_id", ->
|
||||
@expected = {}
|
||||
@expected[@doc1._id] = "/#{@doc1.name}"
|
||||
@expected[@doc2._id] = "/folder1/#{@doc2.name}"
|
||||
@callback
|
||||
.calledWith(null, @expected)
|
||||
.should.equal true
|
||||
|
||||
describe "flushProjectToThirdPartyDataStore", ->
|
||||
beforeEach (done) ->
|
||||
@project = {
|
||||
|
|
Loading…
Reference in a new issue