Files
30-seconds-of-code/test/bind/bind.test.js
Angelos Chalaris 06d7e04220 Added some tests
2018-01-28 16:28:54 +02:00

20 lines
698 B
JavaScript

const test = require('tape');
const bind = require('./bind.js');
test('Testing bind', (t) => {
//For more information on all the methods supported by tape
//Please go to https://github.com/substack/tape
t.true(typeof bind === 'function', 'bind is a Function');
function greet(greeting, punctuation) {
return greeting + ' ' + this.user + punctuation;
}
const freddy = { user: 'fred' };
const freddyBound = bind(greet, freddy);
t.equals(freddyBound('hi', '!'),'hi fred!', 'Binds to an object context');
//t.deepEqual(bind(args..), 'Expected');
//t.equal(bind(args..), 'Expected');
//t.false(bind(args..), 'Expected');
//t.throws(bind(args..), 'Expected');
t.end();
});