diff --git a/services/web/test/UnitTests/coffee/Project/ProjectGetterTests.coffee b/services/web/test/UnitTests/coffee/Project/ProjectGetterTests.coffee index ac3c4c70ea..e2c533f804 100644 --- a/services/web/test/UnitTests/coffee/Project/ProjectGetterTests.coffee +++ b/services/web/test/UnitTests/coffee/Project/ProjectGetterTests.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 diff --git a/services/web/test/UnitTests/coffee/Versioning/AutomaticSnapshotManagerTests.coffee b/services/web/test/UnitTests/coffee/Versioning/AutomaticSnapshotManagerTests.coffee index 3bd541d318..96d768762b 100644 --- a/services/web/test/UnitTests/coffee/Versioning/AutomaticSnapshotManagerTests.coffee +++ b/services/web/test/UnitTests/coffee/Versioning/AutomaticSnapshotManagerTests.coffee @@ -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", ->