|
1 |
| -import { findLcm } from '../FindLcm' |
| 1 | +import { findLcm, findLcmWithHcf } from '../FindLcm' |
2 | 2 |
|
3 | 3 | describe('findLcm', () => {
|
4 | 4 | it('should throw a statement for values less than 1', () => {
|
5 |
| - expect(findLcm(0, 0)).toBe('Please enter values greater than zero.') |
| 5 | + expect(() => { findLcm(0, 0) }).toThrow(Error) |
6 | 6 | })
|
7 | 7 |
|
8 | 8 | it('should throw a statement for one value less than 1', () => {
|
9 |
| - expect(findLcm(1, 0)).toBe('Please enter values greater than zero.') |
10 |
| - expect(findLcm(0, 1)).toBe('Please enter values greater than zero.') |
| 9 | + expect(() => { findLcm(1, 0) }).toThrow(Error) |
| 10 | + expect(() => { findLcm(0, 1) }).toThrow(Error) |
11 | 11 | })
|
12 | 12 |
|
13 | 13 | it('should return an error for values non-integer values', () => {
|
14 |
| - expect(findLcm(4.564, 7.39)).toBe('Please enter whole numbers.') |
| 14 | + expect(() => { findLcm(4.564, 7.39) }).toThrow(Error) |
15 | 15 | })
|
16 | 16 |
|
17 | 17 | it('should return the LCM of two given integers', () => {
|
18 | 18 | expect(findLcm(27, 36)).toBe(108)
|
19 | 19 | })
|
20 | 20 | })
|
| 21 | + |
| 22 | +describe('findLcmWithHcf', () => { |
| 23 | + it('should throw a statement for values less than 1', () => { |
| 24 | + expect(() => { findLcmWithHcf(0, 0) }).toThrow(Error) |
| 25 | + }) |
| 26 | + |
| 27 | + it('should throw a statement for one value less than 1', () => { |
| 28 | + expect(() => { findLcmWithHcf(1, 0) }).toThrow(Error) |
| 29 | + expect(() => { findLcmWithHcf(0, 1) }).toThrow(Error) |
| 30 | + }) |
| 31 | + |
| 32 | + it('should return an error for values non-integer values', () => { |
| 33 | + expect(() => { findLcmWithHcf(4.564, 7.39) }).toThrow(Error) |
| 34 | + }) |
| 35 | + |
| 36 | + it('should return the LCM of two given integers', () => { |
| 37 | + expect(findLcmWithHcf(27, 36)).toBe(108) |
| 38 | + }) |
| 39 | +}) |
0 commit comments