reverse-string/reverse-string.spec.js   A
last analyzed

Complexity

Total Complexity 7
Complexity/F 1

Size

Lines of Code 39
Function Count 7

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 7
eloc 26
mnd 0
bc 0
fnc 7
dl 0
loc 39
bpm 0
cpm 1
noi 0
c 0
b 0
f 0
rs 10
1
import { reverseString } from './reverse-string';
2
3
describe('ReverseString', () => {
4
  test('empty string', () => {
5
    const expected = '';
6
    const actual = reverseString('');
7
    expect(actual).toEqual(expected);
8
  });
9
10
  test('a word', () => {
11
    const expected = 'tobor';
12
    const actual = reverseString('robot');
13
    expect(actual).toEqual(expected);
14
  });
15
16
 test('a capitalized word', () => {
17
    const expected = 'nemaR';
18
    const actual = reverseString('Ramen');
19
    expect(actual).toEqual(expected);
20
  });
21
22
  test('a sentence with punctuation', () => {
23
    const expected = '!yrgnuh ma I';
24
    const actual = reverseString('I am hungry!');
25
    expect(actual).toEqual(expected);
26
  });
27
28
  test('a palindrome', () => {
29
    const expected = 'racecar';
30
    const actual = reverseString('racecar');
31
    expect(actual).toEqual(expected);
32
  });
33
34
  test('an even-sized word', () => {
35
    const expected = 'reward';
36
    const actual = reverseString('drawer');
37
    expect(actual).toEqual(expected);
38
  });
39
});
40