File size: 967 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 25 26 27 28 29 30 31 32 33 34 35 36 |
import isPrimitive from '../../utils/isPrimitive';
describe('isPrimitive', () => {
it('should return true when value is a string', () => {
expect(isPrimitive('foobar')).toBeTruthy();
});
it('should return true when value is a boolean', () => {
expect(isPrimitive(false)).toBeTruthy();
});
it('should return true when value is a number', () => {
expect(isPrimitive(123)).toBeTruthy();
});
it('should return true when value is a symbol', () => {
expect(isPrimitive(Symbol())).toBeTruthy();
});
it('should return true when value is null', () => {
expect(isPrimitive(null)).toBeTruthy();
});
it('should return true when value is undefined', () => {
expect(isPrimitive(undefined)).toBeTruthy();
});
it('should return false when value is an object', () => {
expect(isPrimitive({})).toBeFalsy();
});
it('should return false when value is an array', () => {
expect(isPrimitive([])).toBeFalsy();
});
});
|