|
1 | 1 | 'use strict';
|
2 | 2 |
|
3 | 3 | require('mocha');
|
4 |
| -require('should'); |
| 4 | +var assert = require('assert'); |
5 | 5 | var diff = require('./');
|
6 | 6 |
|
7 |
| -describe('diff', function () { |
8 |
| - it('should diff array:', function () { |
9 |
| - diff(['a', 'b', 'c'], ['b', 'c', 'e']).should.eql(['a']); |
10 |
| - diff(['x', 'b', 'c', 'e', 'y'], ['b', 'x', 'e']).should.eql(['c', 'y']); |
11 |
| - diff(['x', 'x'], ['a', 'b', 'c']).should.eql(['x', 'x']); |
12 |
| - diff(['x'], ['a', 'b', 'c']).should.eql(['x']); |
| 7 | +describe('diff', function() { |
| 8 | + it('should diff array:', function() { |
| 9 | + assert.deepEqual(diff(['a', 'b', 'c'], ['b', 'c', 'e']), ['a']); |
| 10 | + assert.deepEqual(diff(['x', 'b', 'c', 'e', 'y'], ['b', 'x', 'e']), ['c', 'y']); |
| 11 | + assert.deepEqual(diff(['x', 'x'], ['a', 'b', 'c']), ['x', 'x']); |
| 12 | + assert.deepEqual(diff(['x'], ['a', 'b', 'c']), ['x']); |
13 | 13 | });
|
14 | 14 |
|
15 |
| - it('should include duplicates:', function () { |
16 |
| - diff(['x', 'b', 'b', 'b', 'c', 'e', 'y'], ['x', 'e']).should.eql(['b', 'b', 'b', 'c', 'y']); |
| 15 | + it('should include duplicates:', function() { |
| 16 | + assert.deepEqual(diff(['x', 'b', 'b', 'b', 'c', 'e', 'y'], ['x', 'e']), ['b', 'b', 'b', 'c', 'y']); |
17 | 17 | });
|
18 | 18 |
|
19 |
| - it('should diff elements from multiple arrays:', function () { |
20 |
| - diff(['a', 'b', 'c'], ['a'], ['b']).should.eql(['c']); |
| 19 | + it('should diff elements from multiple arrays:', function() { |
| 20 | + assert.deepEqual(diff(['a', 'b', 'c'], ['a'], ['b']), ['c']); |
21 | 21 | });
|
22 | 22 |
|
23 |
| - it('should return an empty array if no unique elements are in the first array:', function () { |
24 |
| - diff(['a'], ['a', 'b', 'c']).should.eql([]); |
| 23 | + it('should return an empty array if no unique elements are in the first array:', function() { |
| 24 | + assert.deepEqual(diff(['a'], ['a', 'b', 'c']), []); |
25 | 25 | });
|
26 | 26 |
|
27 |
| - it('should return the first array if the second array is empty:', function () { |
28 |
| - diff(['a', 'b', 'c'], []).should.eql(['a', 'b', 'c']); |
| 27 | + it('should return the first array if the second array is empty:', function() { |
| 28 | + assert.deepEqual(diff(['a', 'b', 'c'], []), ['a', 'b', 'c']); |
29 | 29 | });
|
30 | 30 |
|
31 |
| - it('should return the first array if no other args are passed:', function () { |
32 |
| - diff(['a', 'b', 'c']).should.eql(['a', 'b', 'c']); |
| 31 | + it('should return the first array if no other args are passed:', function() { |
| 32 | + assert.deepEqual(diff(['a', 'b', 'c']), ['a', 'b', 'c']); |
33 | 33 | });
|
34 | 34 |
|
35 |
| - it('should iterate over sparse arguments:', function () { |
36 |
| - diff(['a', 'b', 'c'], null, ['a', 'b']).should.eql(['c']); |
| 35 | + it('should iterate over sparse arguments:', function() { |
| 36 | + assert.deepEqual(diff(['a', 'b', 'c'], null, ['a', 'b']), ['c']); |
37 | 37 | });
|
38 | 38 | });
|
0 commit comments