June 2019
Intermediate to advanced
192 pages
4h
English
| | const palindromes = require('../palindromes'); |
| | const { prepareStr, isPalindrome, stringStartPalindrome } = palindromes; |
| | |
| | describe('prepareStr()', () => { |
| | it('converts the given string to lowercase', () => { |
| | expect(prepareStr('aAaA')).toBe('aaaa'); |
| | }); |
| | |
| | it('removes all non-letter characters', () => { |
| | expect( |
| | prepareStr('To infinity, and beyond!') |
| | ).toBe('toinfinityandbeyond'); |
| | }); |
| | }); |
| | |
| | describe('isPalindrome()', () => { |
| | it('returns true when given a palindrome', () => { |
| | expect(isPalindrome('aba')).toBe(true); |
| | expect(isPalindrome('abba')).toBe(true); |
| | }); |
| | |
| | it('returns false when given a non-palindrome', () => { |
| |
Read now
Unlock full access