Skip to content

Commit

Permalink
Added plugins test spec
Browse files Browse the repository at this point in the history
  • Loading branch information
notheotherben committed Apr 22, 2015
1 parent b4590cd commit 4db6411
Show file tree
Hide file tree
Showing 3 changed files with 73 additions and 0 deletions.
23 changes: 23 additions & 0 deletions test/Plugins.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions test/Plugins.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

49 changes: 49 additions & 0 deletions test/Plugins.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import Iridium = require('../index');

describe("Plugins",() => {
var core = new Iridium.Core({ database: 'test' });

it("should be registered with an Iridium Core",() => {
core.register({
newModel: (model) => {

},
newInstance: (instance, model) => {

},
validate: []
});
});

describe("newModel",() => {
it("should allow a plugin to define a handler",() => {
core.register({
newModel: (model) => {
model.collectionName = 'changed';
},
newInstance: (instance, model) => { },
validate: []
});
});
it("should allow a plugin not to define a handler",() => {
core.register({
newInstance: (instance, model) => { },
validate: []
});
});
it("should be called when a new model is created",() => {
var model = new Iridium.Model(core,() => { }, 'test', {});
chai.expect(model.collectionName).to.exist.and.equal('changed');
});
});

describe("newInstance",() => {
it("should allow a plugin not to define a handler");
it("should be called when a new instance is created");
});

describe("validators",() => {
it("should make schema validators available for models");
it("should allow a plugin to not define any schema validators");
});
});

0 comments on commit 4db6411

Please sign in to comment.