mirror of
https://github.com/overleaf/overleaf.git
synced 2025-01-28 23:12:32 +00:00
Add unit test for ProjectController.userProjectsJson
This commit is contained in:
parent
bc5769cd73
commit
b1c1cdecef
1 changed files with 26 additions and 1 deletions
|
@ -521,7 +521,32 @@ describe "ProjectController", ->
|
|||
@ProjectUpdateHandler.markAsOpened.calledWith(@project_id).should.equal true
|
||||
done()
|
||||
@ProjectController.loadEditor @req, @res
|
||||
|
||||
|
||||
describe 'userProjectsJson', ->
|
||||
beforeEach (done) ->
|
||||
projects = [
|
||||
{archived: true, id: 'a', name: 'A', accessLevel: 'a', somethingElse: 1}
|
||||
{archived: false, id: 'b', name: 'B', accessLevel: 'b', somethingElse: 1}
|
||||
{archived: false, id: 'c', name: 'C', accessLevel: 'c', somethingElse: 1}
|
||||
{archived: false, id: 'd', name: 'D', accessLevel: 'd', somethingElse: 1}
|
||||
]
|
||||
@ProjectGetter.findAllUsersProjects = sinon.stub().callsArgWith(2, null, [])
|
||||
@ProjectController._buildProjectList = sinon.stub().returns(projects)
|
||||
@AuthenticationController.getLoggedInUserId = sinon.stub().returns 'abc'
|
||||
done()
|
||||
|
||||
it 'should produce a list of projects', (done) ->
|
||||
@res.json = (data) =>
|
||||
expect(data).to.deep.equal {
|
||||
projects: [
|
||||
{_id: 'b', name: 'B', accessLevel: 'b'},
|
||||
{_id: 'c', name: 'C', accessLevel: 'c'},
|
||||
{_id: 'd', name: 'D', accessLevel: 'd'}
|
||||
]
|
||||
}
|
||||
done()
|
||||
@ProjectController.userProjectsJson @req, @res, @next
|
||||
|
||||
describe '_isInPercentageRollout', ->
|
||||
before ->
|
||||
@ids = [
|
||||
|
|
Loading…
Reference in a new issue