mirror of
https://github.com/overleaf/overleaf.git
synced 2025-04-08 08:23:15 +00:00
fixed a couple of tests which broke after async upgrade
This commit is contained in:
parent
9cec91172c
commit
eabd440bb6
2 changed files with 7 additions and 10 deletions
services/web/test/UnitTests/coffee
|
@ -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", ->
|
||||
|
|
Loading…
Add table
Reference in a new issue