2012-02-07 21:09:38 +00:00
|
|
|
if (!chai) {
|
|
|
|
var chai = require('..');
|
|
|
|
}
|
|
|
|
|
|
|
|
suite('plugins', function () {
|
|
|
|
|
|
|
|
function plugin (chai) {
|
2012-04-29 06:32:55 +00:00
|
|
|
if (chai.Assertion.prototype.testing) return;
|
|
|
|
|
2012-02-07 21:09:38 +00:00
|
|
|
Object.defineProperty(chai.Assertion.prototype, 'testing', {
|
|
|
|
get: function () {
|
|
|
|
return 'successful';
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
test('basic usage', function () {
|
|
|
|
chai.use(plugin);
|
|
|
|
var expect = chai.expect;
|
|
|
|
expect(expect('').testing).to.equal('successful');
|
|
|
|
});
|
|
|
|
|
|
|
|
test('double plugin', function () {
|
|
|
|
chai.expect(function () {
|
|
|
|
chai.use(plugin);
|
|
|
|
}).to.not.throw();
|
|
|
|
});
|
|
|
|
});
|