Completed
Push — master ( 734acd...e65e46 )
by Pieter Epeüs
13s queued 10s
created

test/pushIfNotExists.js   A

Complexity

Total Complexity 7
Complexity/F 1

Size

Lines of Code 32
Function Count 7

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 7
eloc 19
mnd 0
bc 0
fnc 7
dl 0
loc 32
rs 10
bpm 0
cpm 1
noi 0
c 0
b 0
f 0
1
import { Arr } from '../src/helpers';
2
3
const a = new Arr();
4
5
const expectedResults = {
6
    test1: ['John'],
7
    test2: ['John', 'Peter'],
8
    test3: ['John', 'Peter'],
9
};
10
11
describe('Push if not exists', () => {
12
    describe('Test 1', () => {
13
        it('Should be return 1 item in the array.', () => {
14
            a.pushIfNotExists('John');
15
            expect(a).toEqual(expectedResults.test1);
16
        });
17
    });
18
19
    describe('Test 2', () => {
20
        it('Should be return 2 item in the array.', () => {
21
            a.pushIfNotExists('Peter');
22
            expect(a).toEqual(expectedResults.test2);
23
        });
24
    });
25
26
    describe('Test 3', () => {
27
        it('Should be return 2 item in the array.', () => {
28
            a.pushIfNotExists('John');
29
            expect(a).toEqual(expectedResults.test3);
30
        });
31
    });
32
});
33