1 | const test = require('tape');
|
2 | const { bind } = require('./instance');
|
3 |
|
4 | test('bind()', assert => {
|
5 | const foo = {
|
6 | bar() {
|
7 | return this.quux;
|
8 | },
|
9 | quux: 42,
|
10 | };
|
11 |
|
12 | bind(foo, 'bar');
|
13 |
|
14 | // deconstruct the method to call it as a function
|
15 | const { bar } = foo;
|
16 |
|
17 | const actual = bar();
|
18 | const expected = 42;
|
19 | const message = 'binds an object property to the object';
|
20 |
|
21 | assert.equal(actual, expected, message);
|
22 | assert.end();
|
23 | });
|