2023-02-01 15:53:54 -08:00
|
|
|
const palindromes = require('./palindromes-solution');
|
2022-02-20 11:07:44 -08:00
|
|
|
|
2023-02-01 15:53:54 -08:00
|
|
|
describe('palindromes', () => {
|
|
|
|
test('works with single words', () => {
|
|
|
|
expect(palindromes('racecar')).toBe(true);
|
2023-01-21 09:53:41 -08:00
|
|
|
});
|
2023-02-01 15:58:58 -08:00
|
|
|
test('works with punctuation ', () => {
|
2023-02-01 15:53:54 -08:00
|
|
|
expect(palindromes('racecar!')).toBe(true);
|
2023-01-21 09:53:41 -08:00
|
|
|
});
|
2023-02-01 15:58:58 -08:00
|
|
|
test('works with upper-case letters ', () => {
|
2023-02-01 15:53:54 -08:00
|
|
|
expect(palindromes('Racecar!')).toBe(true);
|
2023-01-21 09:53:41 -08:00
|
|
|
});
|
2023-02-01 15:58:58 -08:00
|
|
|
test('works with multiple words', () => {
|
2023-02-01 15:53:54 -08:00
|
|
|
expect(palindromes('A car, a man, a maraca.')).toBe(true);
|
2023-01-21 09:53:41 -08:00
|
|
|
});
|
2023-02-01 15:58:58 -08:00
|
|
|
test('works with multiple words', () => {
|
2023-02-01 15:53:54 -08:00
|
|
|
expect(palindromes('Animal loots foliated detail of stool lamina.')).toBe(
|
2023-01-21 09:53:41 -08:00
|
|
|
true
|
|
|
|
);
|
|
|
|
});
|
2023-02-01 15:58:58 -08:00
|
|
|
test("doesn't just always return true", () => {
|
2023-02-01 15:53:54 -08:00
|
|
|
expect(palindromes('ZZZZ car, a man, a maraca.')).toBe(false);
|
2023-01-21 09:53:41 -08:00
|
|
|
});
|
2023-04-08 12:44:15 -07:00
|
|
|
test('works with numbers in a string', () => {
|
|
|
|
expect(palindromes('rac3e3car')).toBe(true);
|
|
|
|
});
|
2023-05-19 23:37:41 -07:00
|
|
|
test('works with unevenly spaced numbers in a string', () => {
|
|
|
|
expect(palindromes('r3ace3car')).toBe(false);
|
|
|
|
});
|
2022-02-20 11:07:44 -08:00
|
|
|
});
|