topics/palindrome/test.js   A
last analyzed

Complexity

Total Complexity 8
Complexity/F 1

Size

Lines of Code 37
Function Count 8

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 8
eloc 20
mnd 0
bc 0
fnc 8
dl 0
loc 37
rs 10
bpm 0
cpm 1
noi 0
c 0
b 0
f 0
1
const {
2
    palindrome,
3
    palindrome2
4
} = require('./index.js');
5
6
test('test palindrome with empty', () => {
7
    expect(palindrome('')).toEqual(true);
8
});
9
10
test('test palindrome with string contain only one character', () => {
11
    expect(palindrome('abba')).toEqual(true);
12
});
13
14
test('test palindrome with abba', () => {
15
    expect(palindrome('abba')).toEqual(true);
16
});
17
18
test('test palindrome with abc', () => {
19
    expect(palindrome('abc')).toEqual(false);
20
});
21
22
// test solution2
23
test('test palindrome2 with empty', () => {
24
    expect(palindrome2('')).toEqual(true);
25
});
26
27
test('test palindrome2 with string contain only one character', () => {
28
    expect(palindrome2('abba')).toEqual(true);
29
});
30
31
test('test palindrome2 with abba', () => {
32
    expect(palindrome2('abba')).toEqual(true);
33
});
34
35
test('test palindrome2 with abc', () => {
36
    expect(palindrome2('abc')).toEqual(false);
37
});