diff --git a/cli/domain/mock.js b/cli/domain/mock.js index 701138354..c93795f1a 100644 --- a/cli/domain/mock.js +++ b/cli/domain/mock.js @@ -23,7 +23,7 @@ module.exports = function(){ } var pluginType = 'static'; - if(fs.existsSync(path.resolve(params.targetValue))){ + if(fs.existsSync(path.resolve(params.targetValue.toString()))){ pluginType = 'dynamic'; } diff --git a/test/unit/cli-domain-mock.js b/test/unit/cli-domain-mock.js index 44576bb9e..7061f3b64 100644 --- a/test/unit/cli-domain-mock.js +++ b/test/unit/cli-domain-mock.js @@ -75,6 +75,33 @@ describe('cli : domain : mock', function(){ }); }); + describe('when mocking a static plugin using a bool value', function(){ + + var data; + beforeEach(function(done){ + data = initialise(); + + data.fs.readJson.yields(null, { something: 'hello' }); + data.fs.writeJson.yields(null, 'ok'); + + executeMocking(data.local, 'plugin', 'isTrue', false, done); + }); + + it('should add mock to oc.json', function(){ + expect(data.fs.writeJson.called).to.be.true; + expect(data.fs.writeJson.args[0][1]).to.eql({ + something: 'hello', + mocks: { + plugins: { + static: { + isTrue: false + } + } + } + }); + }); + }); + describe('when mocking a dynamic plugin', function(){ var data;