Updated the test system

This commit is contained in:
Angelos Chalaris
2018-10-10 23:36:17 +03:00
parent 0f334e1431
commit 1edaed51e4
725 changed files with 385 additions and 2332 deletions

20
test/functionName.test.js Normal file
View File

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