Updated the test system
This commit is contained in:
14
test/bind.test.js
Normal file
14
test/bind.test.js
Normal file
@ -0,0 +1,14 @@
|
||||
const expect = require('expect');
|
||||
const {bind} = require('./_30s.js');
|
||||
|
||||
test('bind is a Function', () => {
|
||||
expect(bind).toBeInstanceOf(Function);
|
||||
});
|
||||
function greet(greeting, punctuation) {
|
||||
return greeting + ' ' + this.user + punctuation;
|
||||
}
|
||||
const freddy = { user: 'fred' };
|
||||
const freddyBound = bind(greet, freddy);
|
||||
test('Binds to an object context', () => {
|
||||
expect(freddyBound('hi', '!')).toBe('hi fred!');
|
||||
});
|
||||
Reference in New Issue
Block a user