From d1466bffcb13edce5faa2072850bb1d10a443615 Mon Sep 17 00:00:00 2001 From: Fabien Franzen Date: Sat, 9 Aug 2014 10:58:03 +0200 Subject: [PATCH] Cleanup mixin tests --- test/mixins.test.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/test/mixins.test.js b/test/mixins.test.js index f1dacf9d..e60f7e02 100644 --- a/test/mixins.test.js +++ b/test/mixins.test.js @@ -42,12 +42,15 @@ mixins.define('TimeStamp', timestamps); describe('Model class', function () { - it('should define a mixin', function() { + it('should define mixins', function() { mixins.define('Example', function(Model, options) { Model.prototype.example = function() { return options; }; }); + mixins.define('Demo', function(Model, options) { + Model.demoMixin = options.ok; + }); }); it('should apply a mixin class', function() { @@ -58,7 +61,7 @@ describe('Model class', function () { var memory = new DataSource('mem', {connector: Memory}, modelBuilder); var Item = memory.createModel('Item', { name: 'string' }, { - mixins: { TimeStamp: true, demo: true, Address: true } + mixins: { Address: true } }); var properties = Item.definition.properties; @@ -70,11 +73,12 @@ describe('Model class', function () { it('should apply mixins', function(done) { var memory = new DataSource('mem', {connector: Memory}, modelBuilder); var Item = memory.createModel('Item', { name: 'string' }, { - mixins: { TimeStamp: true, demo: { ok: true } } + mixins: { TimeStamp: true, Demo: { ok: true } } }); Item.mixin('Example', { foo: 'bar' }); - Item.mixin('other'); + + Item.demoMixin.should.be.true; var properties = Item.definition.properties; properties.createdAt.should.eql({ type: Date });