-
Notifications
You must be signed in to change notification settings - Fork 0
/
isPalindrome.test.js
73 lines (55 loc) · 1.18 KB
/
isPalindrome.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
const isPalindrome = require('./isPalindrome');
it('the empty string is a palindrome',
() => {
// AAA pattern
// Arrange, Act, Assert
const toTest = '';
const result = isPalindrome(toTest);
expect(result).toBe(true);
}
);
it('false for "ab"',
() => {
const toTest= 'ab';
const result = isPalindrome(toTest);
expect(result).toBe(false);
}
);
it('a string constituted only by a single character is a palindrome',
() => {
const toTest = 'z';
const result = isPalindrome(toTest);
expect(result).toBe(true);
}
);
it('"aa" is a palindrome',
() => {
const toTest = 'aa';
const result = isPalindrome(toTest);
expect(result).toBe(true);
}
);
it('"dad" is a palindrome',
() => {
const toTest = 'dad';
const result = isPalindrome(toTest);
expect(result).toBe(true);
});
it('"sad" is not a palindrome',
() => {
const toTest = 'sad';
const result = isPalindrome(toTest);
expect(result).toBe(false);
}
);
it('"drad" is not a palindrome',
() => {
const toTest = 'drad';
debugger;
const result = isPalindrome(toTest);
expect(result).toBe(false);
}
);
// 'dad'
// 'sad'
// 'drad'