Final fixes, all tests running

This commit is contained in:
Angelos Chalaris
2018-06-18 20:41:57 +03:00
parent 977adb1198
commit e9594e6355
49 changed files with 2189 additions and 1198 deletions

View File

@ -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');
});