diff --git a/test/index.js b/test/index.js index 4607859..b3a7fda 100644 --- a/test/index.js +++ b/test/index.js @@ -11,6 +11,7 @@ require('./src/tasks-libraries/model/version.test.js'); require('./src/tasks-docs/github/index.test.js'); require('./src/tasks-core/merge-models.test.js'); +require('./src/tasks-core/normalize-model.test.js'); // require('./src/tasks-core/rsync-cache-data.test.js'); // require('./src/tasks-docs/load-from-github.test.js'); diff --git a/test/src/tasks-core/normalize-model.test.js b/test/src/tasks-core/normalize-model.test.js new file mode 100644 index 0000000..0487716 --- /dev/null +++ b/test/src/tasks-core/normalize-model.test.js @@ -0,0 +1,22 @@ +var Model = require('../../../lib/model'), + normalizeModel = require('../../../lib/tasks-core/normalize-model'); + +describe('tasks-core/normalize-model', function() { + var sandbox = sinon.sandbox.create(), + model = new Model(); + + it('should return function as result', function() { + normalizeModel(model).should.be.instanceOf(Function); + }); + + it('should call model normalization function', function() { + sandbox.stub(model, 'normalize').returns(model); + return normalizeModel(model)().then(function() { + model.normalize.should.be.called; + }); + }); + + it('should return promise with model instance', function() { + return normalizeModel(model)().should.eventually.instanceOf(Model); + }); +});