void.test.ts31 lines · main
| 1 | import { describe, expect, it } from 'vitest' |
| 2 | |
| 3 | import { EMPTY_ARR, EMPTY_OBJ, noop } from './void' |
| 4 | |
| 5 | describe('void utilities', () => { |
| 6 | describe('noop', () => { |
| 7 | it('should return undefined', () => { |
| 8 | expect(noop()).toBeUndefined() |
| 9 | }) |
| 10 | }) |
| 11 | |
| 12 | describe('EMPTY_OBJ', () => { |
| 13 | it('should always return the same reference', () => { |
| 14 | expect(EMPTY_OBJ).toBe(EMPTY_OBJ) |
| 15 | }) |
| 16 | |
| 17 | it('should be an empty object', () => { |
| 18 | expect(Object.keys(EMPTY_OBJ)).toHaveLength(0) |
| 19 | }) |
| 20 | }) |
| 21 | |
| 22 | describe('EMPTY_ARR', () => { |
| 23 | it('should always return the same reference', () => { |
| 24 | expect(EMPTY_ARR).toBe(EMPTY_ARR) |
| 25 | }) |
| 26 | |
| 27 | it('should be an empty array', () => { |
| 28 | expect(EMPTY_ARR).toHaveLength(0) |
| 29 | }) |
| 30 | }) |
| 31 | }) |