odin-default-js-exercises/09_palindromes/solution/palindromes-solution.spec.js

28 lines
873 B
JavaScript
Raw Normal View History

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