Test cleanup and fixes [e-f]

This commit is contained in:
Angelos Chalaris
2018-06-18 16:44:12 +03:00
parent 105185c213
commit 382c452858
27 changed files with 132 additions and 194 deletions

View File

@ -4,22 +4,20 @@ const console = {};
console.debug = (x) => output = x;
const functionName = fn => (console.debug(fn.name), fn);
test('functionName is a Function', () => {
test('functionName is a Function', () => {
expect(functionName).toBeInstanceOf(Function);
});
functionName(Math.max);
test('Works for native functions', () => {
expect(output, 'max').toBe()
functionName(Math.max);
test('Works for native functions', () => {
expect(output).toBe('max');
});
function fun(x) {return x;}
functionName(fun);
test('Works for functions', () => {
expect(output, 'fun').toBe()
function fun(x) {return x;}
functionName(fun);
test('Works for functions', () => {
expect(output).toBe('fun');
});
const fn = x => x;
functionName(fn);
test('Works for arrow functions', () => {
expect(output, 'fn').toBe()
const fn = x => x;
functionName(fn);
test('Works for arrow functions', () => {
expect(output).toBe('fn');
});