|
| 1 | +import { isPalindromeIntegerNumber } from '../isPalindromeIntegerNumber' |
| 2 | + |
| 3 | +describe('isPalindromeIntegerNumber', () => { |
| 4 | + it('expects to return true when length of input is 1', () => { |
| 5 | + expect(isPalindromeIntegerNumber(6)).toEqual(true) |
| 6 | + }) |
| 7 | + |
| 8 | + it('expects to return true when input is palindrome', () => { |
| 9 | + expect(isPalindromeIntegerNumber(121)).toEqual(true) |
| 10 | + expect(isPalindromeIntegerNumber(12321)).toEqual(true) |
| 11 | + expect(isPalindromeIntegerNumber(1221)).toEqual(true) |
| 12 | + }) |
| 13 | + |
| 14 | + it('expects to return false when input is not palindrome', () => { |
| 15 | + expect(isPalindromeIntegerNumber(189)).toEqual(false) |
| 16 | + }) |
| 17 | + |
| 18 | + it('expects to return false when input is minus', () => { |
| 19 | + expect(isPalindromeIntegerNumber(-121)).toEqual(false) |
| 20 | + expect(isPalindromeIntegerNumber(-12321)).toEqual(false) |
| 21 | + }) |
| 22 | + |
| 23 | + it('expects to return false when input is not integer number', () => { |
| 24 | + expect(isPalindromeIntegerNumber(123.456)).toEqual(false) |
| 25 | + }) |
| 26 | + |
| 27 | + it('expects to throw error when input is not a number', () => { |
| 28 | + expect(() => isPalindromeIntegerNumber(undefined)).toThrowError() |
| 29 | + expect(() => isPalindromeIntegerNumber({ key: 'val' })).toThrowError() |
| 30 | + expect(() => isPalindromeIntegerNumber([])).toThrowError() |
| 31 | + }) |
| 32 | +}) |
0 commit comments