mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 06:03:45 +01:00
added unit tests for ProjectEntityHandler
This commit is contained in:
@@ -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 = {
|
||||
|
||||
Reference in New Issue
Block a user