forked from TheAlgorithms/JavaScript
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEvenorOdd.test.js
39 lines (31 loc) · 877 Bytes
/
EvenorOdd.test.js
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
37
38
39
import { evenOrOdd } from '../EvenorOdd'
test('check evenOrOdd of 25 is odd', () => {
const res = evenOrOdd(25)
expect(res).toBe('odd')
})
test('check evenOrOdd of 36 is even', () => {
const res = evenOrOdd(36)
expect(res).toBe('even')
})
test('check evenOrOdd of 0 is even', () => {
const res = evenOrOdd(0)
expect(res).toBe('even')
})
test('check evenOrOdd of -13 is odd', () => {
const res = evenOrOdd(-13)
expect(res).toBe('odd')
})
test('check evenOrOdd of 4294967295 is odd', () => {
const res = evenOrOdd(4294967295)
expect(res).toBe('odd')
})
test('check evenOrOdd of -36 is even', () => {
const res = evenOrOdd(-36)
expect(res).toBe('even')
})
test('check evenOrOdd of 21.1 throws error', () => {
expect(() => evenOrOdd(21.1)).toThrow()
})
test('check evenOrOdd of {} throws error', () => {
expect(() => evenOrOdd({})).toThrow()
})