mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-25 02:00:10 +02:00
fixed a couple of tests which broke after async upgrade
This commit is contained in:
@@ -5,6 +5,7 @@ expect = chai.expect
|
||||
modulePath = "../../../../app/js/Features/Project/ProjectGetter.js"
|
||||
SandboxedModule = require('sandboxed-module')
|
||||
ObjectId = require("mongojs").ObjectId
|
||||
assert = require("chai").assert
|
||||
|
||||
describe "ProjectGetter", ->
|
||||
beforeEach ->
|
||||
@@ -57,7 +58,8 @@ describe "ProjectGetter", ->
|
||||
@db.users.find = (query, callback) =>
|
||||
callback null, [@user_lookup[query._id.toString()]]
|
||||
sinon.spy @db.users, "find"
|
||||
@ProjectGetter.populateProjectWithUsers @project, @callback
|
||||
@ProjectGetter.populateProjectWithUsers @project, (err, project)=>
|
||||
@callback err, project
|
||||
|
||||
it "should look up each user", ->
|
||||
for user in @users
|
||||
@@ -73,5 +75,5 @@ describe "ProjectGetter", ->
|
||||
expect(@project.collaberator_refs).to.deep.equal [@users[3], @users[4]]
|
||||
|
||||
it "should call the callback", ->
|
||||
@callback.calledWith(null, @project).should.equal true
|
||||
assert.deepEqual @callback.args[0][1], @project
|
||||
|
||||
|
||||
@@ -108,20 +108,15 @@ describe 'AutomaticSnapshotManager', ->
|
||||
callback(null, @project_ids)
|
||||
else
|
||||
throw new Error("unexpected key: #{key}")
|
||||
sinon.stub(@AutomaticSnapshotManager, "takeSnapshotIfRequired")
|
||||
.callsArgWith(1)
|
||||
@AutomaticSnapshotManager.takeAutomaticSnapshots(@callback)
|
||||
sinon.stub(@AutomaticSnapshotManager, "takeSnapshotIfRequired").callsArgWith(1, null)
|
||||
@AutomaticSnapshotManager.takeAutomaticSnapshots @callback
|
||||
|
||||
afterEach ->
|
||||
@AutomaticSnapshotManager.takeSnapshotIfRequired.restore()
|
||||
|
||||
it "should call takeSnapshotIfRequired for each project id", ->
|
||||
for project_id in @project_ids
|
||||
@AutomaticSnapshotManager.takeSnapshotIfRequired.calledWith(project_id)
|
||||
.should.equal true
|
||||
|
||||
it "should call the callback", ->
|
||||
@callback.calledWith(null).should.equal true
|
||||
@callback.calledWith(undefined).should.equal true
|
||||
|
||||
|
||||
describe "removing project from marked set", ->
|
||||
|
||||
Reference in New Issue
Block a user