Skip to content

Commit 9d2ad5d

Browse files
authored
Palindromes: Restructure and rename tests for clarity (#629)
1 parent 05f2122 commit 9d2ad5d

2 files changed

Lines changed: 22 additions & 30 deletions

File tree

Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,25 @@
11
const palindromes = require('./palindromes')
22

33
describe('palindromes', () => {
4-
test('works with single words', () => {
4+
test('detects palindrome', () => {
55
expect(palindromes('racecar')).toBe(true);
66
});
7-
test.skip('works with punctuation ', () => {
8-
expect(palindromes('racecar!')).toBe(true);
9-
});
10-
test.skip('works with upper-case letters ', () => {
11-
expect(palindromes('Racecar!')).toBe(true);
7+
test.skip('detects palindrome with numbers', () => {
8+
expect(palindromes('rac3e3car')).toBe(true);
129
});
13-
test.skip('works with multiple words', () => {
10+
test.skip('detects palindrome with multiple words', () => {
1411
expect(palindromes('A car, a man, a maraca.')).toBe(true);
1512
});
16-
test.skip('works with multiple words', () => {
17-
expect(palindromes('Animal loots foliated detail of stool lamina.')).toBe(true);
13+
test.skip('ignores punctuation', () => {
14+
expect(palindromes('racecar!')).toBe(true);
1815
});
19-
test.skip('doesn\'t just always return true', () => {
20-
expect(palindromes('ZZZZ car, a man, a maracaz.')).toBe(false);
16+
test.skip('is case insensitive', () => {
17+
expect(palindromes('Racecar!')).toBe(true);
2118
});
22-
test.skip('works with numbers in a string', () => {
23-
expect(palindromes('rac3e3car')).toBe(true);
19+
test.skip('detects non-palindromes', () => {
20+
expect(palindromes('ZZZZ car, a man, a maracaz.')).toBe(false);
2421
});
25-
test.skip('works with unevenly spaced numbers in a string', () => {
22+
test.skip('detects non-palindromes with numbers', () => {
2623
expect(palindromes('r3ace3car')).toBe(false);
2724
});
2825
});
Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,25 @@
11
const palindromes = require('./palindromes-solution');
22

33
describe('palindromes', () => {
4-
test('works with single words', () => {
4+
test('detects palindrome', () => {
55
expect(palindromes('racecar')).toBe(true);
66
});
7-
test('works with punctuation ', () => {
8-
expect(palindromes('racecar!')).toBe(true);
9-
});
10-
test('works with upper-case letters ', () => {
11-
expect(palindromes('Racecar!')).toBe(true);
7+
test('detects palindrome with numbers', () => {
8+
expect(palindromes('rac3e3car')).toBe(true);
129
});
13-
test('works with multiple words', () => {
10+
test('detects palindrome with multiple words', () => {
1411
expect(palindromes('A car, a man, a maraca.')).toBe(true);
1512
});
16-
test('works with multiple words', () => {
17-
expect(palindromes('Animal loots foliated detail of stool lamina.')).toBe(
18-
true
19-
);
13+
test('ignores punctuation', () => {
14+
expect(palindromes('racecar!')).toBe(true);
2015
});
21-
test("doesn't just always return true", () => {
22-
expect(palindromes('ZZZZ car, a man, a maraca.')).toBe(false);
16+
test('is case insensitive', () => {
17+
expect(palindromes('Racecar!')).toBe(true);
2318
});
24-
test('works with numbers in a string', () => {
25-
expect(palindromes('rac3e3car')).toBe(true);
19+
test('detects non-palindromes', () => {
20+
expect(palindromes('ZZZZ car, a man, a maracaz.')).toBe(false);
2621
});
27-
test('works with unevenly spaced numbers in a string', () => {
22+
test('detects non-palindromes with numbers', () => {
2823
expect(palindromes('r3ace3car')).toBe(false);
2924
});
3025
});

0 commit comments

Comments
 (0)