File size: 696 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import isFunction from '../../utils/isFunction';

describe('isFunction', () => {
  it('should return true when value is a function', () => {
    expect(isFunction(() => null)).toBeTruthy();
    expect(
      isFunction(function foo() {
        return null;
      }),
    ).toBeTruthy();
  });

  it('should return false when value is not a function', () => {
    expect(isFunction(null)).toBeFalsy();
    expect(isFunction(undefined)).toBeFalsy();
    expect(isFunction(-1)).toBeFalsy();
    expect(isFunction(0)).toBeFalsy();
    expect(isFunction(1)).toBeFalsy();
    expect(isFunction('')).toBeFalsy();
    expect(isFunction({})).toBeFalsy();
    expect(isFunction([])).toBeFalsy();
  });
});