Skip to content

Instantly share code, notes, and snippets.

@nlf
Created February 4, 2015 23:47
Show Gist options
  • Save nlf/3dfa09588e2f5e06b36f to your computer and use it in GitHub Desktop.
Save nlf/3dfa09588e2f5e06b36f to your computer and use it in GitHub Desktop.
var User = new WOG({
name: 'user',
schema: {
name: Joi.string().required(),
age: Joi.number().integer().default(20)
}
});
var Plugin = function (collection) {
expect(collection).to.exist();
expect(collection.name).to.equal('user');
expect(collection.schema.isJoi).to.equal(true);
var user = new User({ name: 'test' });
expect(user.test).to.exist();
expect(user.test()).to.equal('test');
expect(User.test).to.exist();
expect(User.test()).to.equal(true);
done();
};
Plugin.prototype.test = function () {
return this.name;
};
Plugin.test = function () {
return true;
};
User.use(Plugin);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment