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