-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
/
FindLcm.test.js
55 lines (47 loc) · 1.27 KB
/
FindLcm.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
import { findLcm, findLcmWithHcf } from '../FindLcm'
describe('findLcm', () => {
it('should throw a statement for values less than 1', () => {
expect(() => {
findLcm(0, 0)
}).toThrow(Error)
})
it('should throw a statement for one value less than 1', () => {
expect(() => {
findLcm(1, 0)
}).toThrow(Error)
expect(() => {
findLcm(0, 1)
}).toThrow(Error)
})
it('should return an error for values non-integer values', () => {
expect(() => {
findLcm(4.564, 7.39)
}).toThrow(Error)
})
it('should return the LCM of two given integers', () => {
expect(findLcm(27, 36)).toBe(108)
})
})
describe('findLcmWithHcf', () => {
it('should throw a statement for values less than 1', () => {
expect(() => {
findLcmWithHcf(0, 0)
}).toThrow(Error)
})
it('should throw a statement for one value less than 1', () => {
expect(() => {
findLcmWithHcf(1, 0)
}).toThrow(Error)
expect(() => {
findLcmWithHcf(0, 1)
}).toThrow(Error)
})
it('should return an error for values non-integer values', () => {
expect(() => {
findLcmWithHcf(4.564, 7.39)
}).toThrow(Error)
})
it('should return the LCM of two given integers', () => {
expect(findLcmWithHcf(27, 36)).toBe(108)
})
})