Final fixes, all tests running
This commit is contained in:
@ -1,23 +1,18 @@
|
||||
const expect = require('expect');
|
||||
let output = '';
|
||||
const console = {};
|
||||
console.debug = (x) => output = x;
|
||||
const functionName = fn => (console.debug(fn.name), fn);
|
||||
const functionName = fn => fn.name;
|
||||
|
||||
test('functionName is a Function', () => {
|
||||
expect(functionName).toBeInstanceOf(Function);
|
||||
});
|
||||
functionName(Math.max);
|
||||
test('Works for native functions', () => {
|
||||
expect(output).toBe('max');
|
||||
expect(functionName(Math.max)).toBe('max');
|
||||
});
|
||||
function fun(x) {return x;}
|
||||
functionName(fun);
|
||||
test('Works for functions', () => {
|
||||
expect(output).toBe('fun');
|
||||
expect(functionName(fun)).toBe('fun');
|
||||
});
|
||||
const fn = x => x;
|
||||
functionName(fn);
|
||||
test('Works for arrow functions', () => {
|
||||
expect(output).toBe('fn');
|
||||
expect(functionName(fn)).toBe('fn');
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user