Files
30-seconds-of-code/test/bind/bind.test.js
Angelos Chalaris 4f7da1be9b Test migration to jest by hand
Apparently using regular expressions is way easier.
2018-06-18 15:15:56 +03:00

18 lines
434 B
JavaScript

const expect = require('expect');
const bind = require('./bind.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', '!'),'hi fred!').toBe()
});