Skip to content

Commit 698537f

Browse files
committed
fix test expect error
1 parent 41f0116 commit 698537f

File tree

4 files changed

+24
-11
lines changed

4 files changed

+24
-11
lines changed

__tests__/Conversion.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
import { describe, expect, it } from '@jest/globals';
2-
import { fromJS, is, List, Map, OrderedMap, Record } from 'immutable';
2+
import {
3+
type Collection,
4+
fromJS,
5+
is,
6+
List,
7+
Map,
8+
OrderedMap,
9+
Record,
10+
} from 'immutable';
311
import fc, { type JsonValue } from 'fast-check';
412

513
describe('Conversion', () => {
@@ -126,7 +134,7 @@ describe('Conversion', () => {
126134
// @ts-expect-error -- to convert to real typing
127135
return new Point(sequence);
128136
}
129-
// @ts-expect-error unknown any type
137+
130138
return Array.isArray(this[key])
131139
? sequence.toList()
132140
: sequence.toOrderedMap();
@@ -145,7 +153,7 @@ describe('Conversion', () => {
145153
function (this: typeof js, key: any, sequence, keypath) {
146154
expect(arguments.length).toBe(3);
147155
paths.push(keypath);
148-
// @ts-expect-error unknown any type
156+
149157
return Array.isArray(this[key])
150158
? sequence.toList()
151159
: sequence.toOrderedMap();

__tests__/slice.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,9 @@ describe('slice', () => {
234234
(valuesLen, args) => {
235235
const a = Range(0, valuesLen).toArray();
236236
const v = List(a);
237-
const slicedV = v.slice.apply(v, args);
238-
const slicedA = a.slice.apply(a, args);
237+
238+
const slicedV = v.slice(...args);
239+
const slicedA = a.slice(...args);
239240
expect(slicedV.toArray()).toEqual(slicedA);
240241
}
241242
)
@@ -251,8 +252,8 @@ describe('slice', () => {
251252
const a: Array<number> = [];
252253
entries.forEach((entry) => (a[entry[0]] = entry[1]));
253254
const s = Seq(a);
254-
const slicedS = s.slice.apply(s, args);
255-
const slicedA = a.slice.apply(a, args);
255+
const slicedS = s.slice(...args);
256+
const slicedA = a.slice(...args);
256257
expect(slicedS.toArray()).toEqual(slicedA);
257258
}
258259
)

__tests__/splice.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,15 @@ describe('splice', () => {
5151
fc.assert(
5252
fc.property(
5353
fc.array(fc.integer()),
54-
fc.array(fc.sparseArray(fc.integer())),
55-
(values, args) => {
54+
fc.integer(),
55+
fc.integer(),
56+
fc.array(fc.integer()),
57+
(values, index, removeNum, insertValues) => {
5658
const v = List(values);
5759
const a = values.slice(); // clone
58-
const splicedV = v.splice.apply(v, args); // persistent
59-
a.splice.apply(a, args); // mutative
60+
61+
const splicedV = v.splice(index, removeNum, ...insertValues); // persistent
62+
a.splice(index, removeNum, ...insertValues); // mutative
6063
expect(splicedV.toArray()).toEqual(a);
6164
}
6265
)

__tests__/updateIn.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ describe('updateIn', () => {
8181
this.length = values.length;
8282

8383
for (let i = 0; i < values.length; i++) {
84+
// @ts-expect-error -- TypeScript does not know that this is a valid index
8485
this[i] = values[i];
8586
}
8687
}

0 commit comments

Comments
 (0)