Updated the test system
This commit is contained in:
20
test/functionName.test.js
Normal file
20
test/functionName.test.js
Normal 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');
|
||||
});
|
||||
Reference in New Issue
Block a user