fix unit tests

packManager now uses LockManager, which tries to talk to redis and
needs to be replaced by a stub in the unit tests.
This commit is contained in:
Brian Gough 2015-06-05 10:59:09 +01:00
parent c2e5c2c751
commit 76d1350593
2 changed files with 4 additions and 0 deletions

View file

@ -12,6 +12,7 @@ describe "HttpController", ->
"./UpdatesManager": @UpdatesManager = {} "./UpdatesManager": @UpdatesManager = {}
"./DiffManager": @DiffManager = {} "./DiffManager": @DiffManager = {}
"./RestoreManager": @RestoreManager = {} "./RestoreManager": @RestoreManager = {}
"./PackManager": @PackManager = {}
@doc_id = "doc-id-123" @doc_id = "doc-id-123"
@project_id = "project-id-123" @project_id = "project-id-123"
@next = sinon.stub() @next = sinon.stub()

View file

@ -3,6 +3,7 @@ chai = require('chai')
should = chai.should() should = chai.should()
expect = chai.expect expect = chai.expect
modulePath = "../../../../app/js/MongoManager.js" modulePath = "../../../../app/js/MongoManager.js"
packModulePath = "../../../../app/js/PackManager.js"
SandboxedModule = require('sandboxed-module') SandboxedModule = require('sandboxed-module')
{ObjectId} = require("mongojs") {ObjectId} = require("mongojs")
tk = require "timekeeper" tk = require "timekeeper"
@ -12,6 +13,8 @@ describe "MongoManager", ->
tk.freeze(new Date()) tk.freeze(new Date())
@MongoManager = SandboxedModule.require modulePath, requires: @MongoManager = SandboxedModule.require modulePath, requires:
"./mongojs" : { db: @db = {}, ObjectId: ObjectId } "./mongojs" : { db: @db = {}, ObjectId: ObjectId }
"./PackManager" : SandboxedModule.require packModulePath, requires:
"./LockManager" : {}
@callback = sinon.stub() @callback = sinon.stub()
@doc_id = ObjectId().toString() @doc_id = ObjectId().toString()
@project_id = ObjectId().toString() @project_id = ObjectId().toString()