|
| 1 | +import { isPronicNumber } from '../PronicNumber.js' |
| 2 | + |
| 3 | +describe('isPronicNumber', () => { |
| 4 | + test('0 is a pronic number (0 x 1)', () => { |
| 5 | + expect(isPronicNumber(0)).toBe(true) |
| 6 | + }) |
| 7 | + |
| 8 | + test('2 is a pronic number (1 x 2)', () => { |
| 9 | + expect(isPronicNumber(2)).toBe(true) |
| 10 | + }) |
| 11 | + |
| 12 | + test('6 is a pronic number (2 x 3)', () => { |
| 13 | + expect(isPronicNumber(6)).toBe(true) |
| 14 | + }) |
| 15 | + |
| 16 | + test('12 is a pronic number (3 x 4)', () => { |
| 17 | + expect(isPronicNumber(12)).toBe(true) |
| 18 | + }) |
| 19 | + |
| 20 | + test('20 is a pronic number (4 x 5)', () => { |
| 21 | + expect(isPronicNumber(20)).toBe(true) |
| 22 | + }) |
| 23 | + |
| 24 | + test('30 is a pronic number (5 x 6)', () => { |
| 25 | + expect(isPronicNumber(30)).toBe(true) |
| 26 | + }) |
| 27 | + |
| 28 | + test('42 is a pronic number (6 x 7)', () => { |
| 29 | + expect(isPronicNumber(42)).toBe(true) |
| 30 | + }) |
| 31 | + |
| 32 | + test('1 is NOT a pronic number', () => { |
| 33 | + expect(isPronicNumber(1)).toBe(false) |
| 34 | + }) |
| 35 | + |
| 36 | + test('10 is NOT a pronic number', () => { |
| 37 | + expect(isPronicNumber(10)).toBe(false) |
| 38 | + }) |
| 39 | + |
| 40 | + test('15 is NOT a pronic number', () => { |
| 41 | + expect(isPronicNumber(15)).toBe(false) |
| 42 | + }) |
| 43 | + |
| 44 | + test('throws TypeError for negative input', () => { |
| 45 | + expect(() => isPronicNumber(-1)).toThrow(TypeError) |
| 46 | + }) |
| 47 | + |
| 48 | + test('throws TypeError for float input', () => { |
| 49 | + expect(() => isPronicNumber(6.5)).toThrow(TypeError) |
| 50 | + }) |
| 51 | +}) |
0 commit comments