test: partially fix broken tests (#5733)

* test: fix throttle.spec.js

Signed-off-by: tison <wander4096@gmail.com>

* test: fix pickBy.spec.js

Signed-off-by: tison <wander4096@gmail.com>

* test: fix isBuffer.spec.js

Signed-off-by: tison <wander4096@gmail.com>

* test: partially fix attempt.spec.js

Signed-off-by: tison <wander4096@gmail.com>

* test: partially fix dropRightWhile.spec.js

Signed-off-by: tison <wander4096@gmail.com>

* test: fix defer.spec.js and rest.spec.js

Signed-off-by: tison <wander4096@gmail.com>

* test: fix invoke.spec.js

Signed-off-by: tison <wander4096@gmail.com>

* test: fix isArray.spec.js

Signed-off-by: tison <wander4096@gmail.com>

* test: partially fix iteration-methods.spec.js

Signed-off-by: tison <wander4096@gmail.com>

* test: fix xor-methods.spec.js

Signed-off-by: tison <wander4096@gmail.com>

* test: fix property.spec.js

Signed-off-by: tison <wander4096@gmail.com>

* test: fix ary.spec.js

Signed-off-by: tison <wander4096@gmail.com>

* test: fix omit-methods.spec.js

Signed-off-by: tison <wander4096@gmail.com>

* test: fix debounce-and-throttle.spec.js

Signed-off-by: tison <wander4096@gmail.com>

* test: fix unzip-and-zip.spec.js

Signed-off-by: tison <wander4096@gmail.com>

* test: fix toPairs-methods.spec.js

Signed-off-by: tison <wander4096@gmail.com>

* test: fix exit-early.spec.js

Signed-off-by: tison <wander4096@gmail.com>

* test: temporarily comment out takeWhile and dropWhile tests

Signed-off-by: tison <wander4096@gmail.com>

* test: partially fix union*.spec.js

Signed-off-by: tison <wander4096@gmail.com>

* test: fix startsWith-and-endsWith.spec.js

Signed-off-by: tison <wander4096@gmail.com>

* test: fix isNil.spec.js

Signed-off-by: tison <wander4096@gmail.com>

* test: fix some of syntax errors

Signed-off-by: tison <wander4096@gmail.com>

---------

Signed-off-by: tison <wander4096@gmail.com>
This commit is contained in:
tison
2023-09-21 22:40:27 +08:00
committed by GitHub
parent 49683ffd5d
commit bd518dd906
52 changed files with 319 additions and 324 deletions

View File

@@ -8,15 +8,15 @@ describe('pullAt', () => {
const actual = pullAt(array, [0, 1]);
expect(array).toEqual([3]);
expect(actual, [1).toEqual(2]);
expect(actual).toEqual([1, 2]);
});
it('should work with unsorted indexes', () => {
const array = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
const actual = pullAt(array, [1, 3, 11, 7, 5, 9]);
expect(array, [1, 3, 5, 7, 9).toEqual(11]);
expect(actual, [2, 4, 12, 8, 6).toEqual(10]);
expect(array).toEqual([1, 3, 5, 7, 9, 11]);
expect(actual).toEqual([2, 4, 12, 8, 6, 10]);
});
it('should work with repeated indexes', () => {
@@ -24,7 +24,7 @@ describe('pullAt', () => {
const actual = pullAt(array, [0, 2, 0, 1, 0, 2]);
expect(array).toEqual([4]);
expect(actual, [1, 3, 1, 2, 1).toEqual(3]);
expect(actual).toEqual([1, 3, 1, 2, 1, 3]);
});
it('should use `undefined` for nonexistent indexes', () => {
@@ -32,16 +32,16 @@ describe('pullAt', () => {
const actual = pullAt(array, [2, 4, 0]);
expect(array).toEqual(['b']);
expect(actual, ['c', undefined).toEqual('a']);
expect(actual).toEqual(['c', undefined, 'a']);
});
it('should flatten `indexes`', () => {
let array = ['a', 'b', 'c'];
expect(pullAt(array, 2, 0), ['c').toEqual('a']);
expect(pullAt(array, 2, 0)).toEqual(['c', 'a']);
expect(array).toEqual(['b']);
array = ['a', 'b', 'c', 'd'];
expect(pullAt(array, [3, 0], 2), ['d', 'a').toEqual('c']);
expect(pullAt(array, [3, 0], 2)).toEqual(['d', 'a', 'c']);
expect(array).toEqual(['b']);
});
@@ -49,12 +49,12 @@ describe('pullAt', () => {
const array = ['a', 'b', 'c'];
let actual = pullAt(array);
expect(array, ['a', 'b').toEqual('c']);
expect(array).toEqual(['a', 'b', 'c']);
expect(actual).toEqual([]);
actual = pullAt(array, [], []);
expect(array, ['a', 'b').toEqual('c']);
expect(array).toEqual(['a', 'b', 'c']);
expect(actual).toEqual([]);
});
@@ -91,7 +91,7 @@ describe('pullAt', () => {
return pullAt(array, key);
});
expect(actual, [[-2], [-2], [-1]).toEqual([-1]]);
expect(actual).toEqual([[-2], [-2], [-1], [-1]]);
});
it('should support deep paths', () => {