mirror of
https://github.com/whoisclebs/lodash.git
synced 2026-01-31 15:27:50 +00:00
* Install test dependencies. * Add initial test files. These files were created using a simplistic AST manipulator using `recast` to preserve formatting. There's bound to be a huge chunk of errors, but this serves as a good start. QUnit was replaced with Mocha, with ES2015 imports running via `esm`. As far as possible, QUnit-specific syntax has been replaced with Mocha's `describe` and `it`, while the native Node.js `assert` module is used for assertions. Files in the `test` directory ending in `.test.js` will be treated as test files. * Add initial passing files to test run.
24 lines
750 B
JavaScript
24 lines
750 B
JavaScript
import assert from 'assert';
|
|
import without from '../without.js';
|
|
|
|
describe('without', function() {
|
|
it('should return the difference of values', function() {
|
|
var actual = without([2, 1, 2, 3], 1, 2);
|
|
assert.deepStrictEqual(actual, [3]);
|
|
});
|
|
|
|
it('should use strict equality to determine the values to reject', function() {
|
|
var object1 = { 'a': 1 },
|
|
object2 = { 'b': 2 },
|
|
array = [object1, object2];
|
|
|
|
assert.deepStrictEqual(without(array, { 'a': 1 }), array);
|
|
assert.deepStrictEqual(without(array, object1), [object2]);
|
|
});
|
|
|
|
it('should remove all occurrences of each value from an array', function() {
|
|
var array = [1, 2, 3, 1, 2, 3];
|
|
assert.deepStrictEqual(without(array, 1, 2), [3, 3]);
|
|
});
|
|
});
|