Created
February 4, 2015 23:47
-
-
Save nlf/3dfa09588e2f5e06b36f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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