forked from TheAlgorithms/JavaScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPalindrome.test.js
More file actions
24 lines (20 loc) · 754 Bytes
/
Palindrome.test.js
File metadata and controls
24 lines (20 loc) · 754 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import { palindrome } from '../Palindrome'
describe('Palindrome', () => {
it('expects to return true for palindrome string', () => {
const isPalindrome = palindrome('madam')
expect(isPalindrome).toBe(true)
})
it('expects to return true for Empty String', () => {
const isPalindrome = palindrome('')
expect(isPalindrome).toBe(true)
})
it('expects to return false for non-palindrome string', () => {
const isPalindrome = palindrome('foobar')
expect(isPalindrome).toBe(false)
})
it('Throw Error for Invalid Input', () => {
expect(() => palindrome(123)).toThrow('Invalid Input')
expect(() => palindrome(null)).toThrow('Invalid Input')
expect(() => palindrome(undefined)).toThrow('Invalid Input')
})
})