|
| 1 | +import { evenOrOdd } from '../EvenorOdd' |
| 2 | + |
| 3 | +test('check evenOrOdd of 25 is odd', () => { |
| 4 | + const res = evenOrOdd(25) |
| 5 | + expect(res).toBe('odd') |
| 6 | +}) |
| 7 | + |
| 8 | +test('check evenOrOdd of 36 is even', () => { |
| 9 | + const res = evenOrOdd(36) |
| 10 | + expect(res).toBe('even') |
| 11 | +}) |
| 12 | + |
| 13 | +test('check evenOrOdd of 0 is even', () => { |
| 14 | + const res = evenOrOdd(0) |
| 15 | + expect(res).toBe('even') |
| 16 | +}) |
| 17 | + |
| 18 | +test('check evenOrOdd of -13 is odd', () => { |
| 19 | + const res = evenOrOdd(-13) |
| 20 | + expect(res).toBe('odd') |
| 21 | +}) |
| 22 | + |
| 23 | +test('check evenOrOdd of 4294967295 is odd', () => { |
| 24 | + const res = evenOrOdd(4294967295) |
| 25 | + expect(res).toBe('odd') |
| 26 | +}) |
| 27 | + |
| 28 | +test('check evenOrOdd of -36 is even', () => { |
| 29 | + const res = evenOrOdd(-36) |
| 30 | + expect(res).toBe('even') |
| 31 | +}) |
| 32 | + |
| 33 | +test('check evenOrOdd of 21.1 throws error', () => { |
| 34 | + expect(() => evenOrOdd(21.1)).toThrow() |
| 35 | +}) |
| 36 | + |
| 37 | +test('check evenOrOdd of {} throws error', () => { |
| 38 | + expect(() => evenOrOdd({})).toThrow() |
| 39 | +}) |
0 commit comments