deno.land / x / chai@v4.3.6 / test / plugins.js

نووسراو ببینە
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
describe('plugins', function () {
function plugin (chai) { if (chai.Assertion.prototype.testing) return;
Object.defineProperty(chai.Assertion.prototype, 'testing', { get: function () { return 'successful'; } }); }
it('basic usage', function () { chai.use(plugin); var expect = chai.expect; expect(expect('').testing).to.equal('successful'); });
it('double plugin', function () { chai.expect(function () { chai.use(plugin); }).to.not.throw(); });
it('.use detached from chai object', function () { function anotherPlugin (chai) { Object.defineProperty(chai.Assertion.prototype, 'moreTesting', { get: function () { return 'more success'; } }); }
var use = chai.use; use(anotherPlugin);
var expect = chai.expect; expect(expect('').moreTesting).to.equal('more success'); });});
chai

Version Info

Tagged at
2 years ago

External Dependencies

No external dependencies 🎉