-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.js
More file actions
46 lines (45 loc) · 2.24 KB
/
test.js
File metadata and controls
46 lines (45 loc) · 2.24 KB
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
var chai = require('chai');
var expect = chai.expect;
var arrayUniquify = require('./arrayUniquify');
describe('arrayUniq function', function() {
it('will return uniq version of array if in array there are duplicate element', function() {
var testArray = [1,2,1];
var expectedResult = [1,2];
expect(arrayUniquify(testArray)).to.eql(expectedResult);
})
it('will return uniq version of array if in array there are duplicate element', function() {
var testArray = [1,2,1,1,1,1,1,1,1,1,1,1];
var expectedResult = [1,2];
expect(arrayUniquify(testArray)).to.eql(expectedResult);
})
it('will return uniq version of array if in array there are duplicate element', function() {
var testArray = [1,2,1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2];
var expectedResult = [1,2];
expect(arrayUniquify(testArray)).to.eql(expectedResult);
})
it('will return uniq version of array if in array there are duplicate element', function() {
var testArray = [1,2,1,1,1,1,1,1,1,1,1,1,2,2,2,6,2,2,2,2,2,3,2,2,2,2,2,2,2,2,2,2];
var expectedResult = [1,2,6,3];
expect(arrayUniquify(testArray)).to.eql(expectedResult);
})
it('will return uniq version of array if in array there are duplicate element', function() {
var testArray = [1,2,1,1,1,1,1,1,1,1,1,1,2,2,2,6,2,2,2,2,2,3,2,2,2,2,2,2,2,2,2,2,10];
var expectedResult = [1,2,6,3,10];
expect(arrayUniquify(testArray)).to.eql(expectedResult);
})
it('will return uniq version of array if in array there are duplicate element', function() {
var testArray = ["james", "edward", "budimen", "superman"];
var expectedResult = ["james", "edward", "budimen", "superman"];
expect(arrayUniquify(testArray)).to.eql(expectedResult);
})
it('will return uniq version of array if in array there are duplicate element', function() {
var testArray = ["james", "edward", "budimen", "superman", "edward", "jancok"];
var expectedResult = ["james", "edward", "budimen", "superman", "jancok"];
expect(arrayUniquify(testArray)).to.eql(expectedResult);
})
it('will return uniq version of array if in array there are duplicate element', function() {
var testArray = [1,1,1,1,1,3,3,3,3,3,3,3,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5];
var expectedResult = [1,3,4,5];
expect(arrayUniquify(testArray)).to.eql(expectedResult);
})
})