@@ -5,7 +5,7 @@ import "blob-polyfill";
5
5
import { ReadableStream } from "web-streams-polyfill" ;
6
6
import { LIST_STATUS } from "@models/list" ;
7
7
import { StreamListDiff } from "@models/stream" ;
8
- import { streamListDiffClient } from "." ;
8
+ import { streamListDiff } from "." ;
9
9
import prevListFile from "../../../mocks/prevList.json" ;
10
10
import nextListFile from "../../../mocks/nextList.json" ;
11
11
@@ -18,7 +18,7 @@ describe("data emission", () => {
18
18
{ id : 1 , name : "Item 1" } ,
19
19
{ id : 2 , name : "Item 2" } ,
20
20
] ;
21
- const diff = streamListDiffClient ( [ ] , nextList , "id" , { chunksSize : 2 } ) ;
21
+ const diff = streamListDiff ( [ ] , nextList , "id" , { chunksSize : 2 } ) ;
22
22
23
23
const expectedChunks = [
24
24
{
@@ -53,7 +53,7 @@ describe("data emission", () => {
53
53
{ id : 1 , name : "Item 1" } ,
54
54
{ id : 2 , name : "Item 2" } ,
55
55
] ;
56
- const diff = streamListDiffClient ( prevList , [ ] , "id" , { chunksSize : 2 } ) ;
56
+ const diff = streamListDiff ( prevList , [ ] , "id" , { chunksSize : 2 } ) ;
57
57
58
58
const expectedChunks = [
59
59
{
@@ -93,7 +93,7 @@ describe("data emission", () => {
93
93
{ id : 2 , name : "Item 2" } ,
94
94
{ id : 3 , name : "Item 3" } ,
95
95
] ;
96
- const diff = streamListDiffClient ( prevList , nextList , "id" ) ;
96
+ const diff = streamListDiff ( prevList , nextList , "id" ) ;
97
97
98
98
const expectedChunks = [
99
99
[
@@ -164,7 +164,7 @@ describe("data emission", () => {
164
164
{ id : 9 , name : "Item 9" } ,
165
165
{ id : 8 , name : "Item 8" } ,
166
166
] ;
167
- const diff = streamListDiffClient ( prevList , nextList , "id" , {
167
+ const diff = streamListDiff ( prevList , nextList , "id" , {
168
168
chunksSize : 5 ,
169
169
} ) ;
170
170
@@ -291,7 +291,7 @@ describe("data emission", () => {
291
291
{ id : 5 , name : "Item 5" } ,
292
292
] ;
293
293
294
- const diff = streamListDiffClient ( prevList , nextList , "id" , {
294
+ const diff = streamListDiff ( prevList , nextList , "id" , {
295
295
chunksSize : 150 ,
296
296
} ) ;
297
297
@@ -362,7 +362,7 @@ describe("data emission", () => {
362
362
{ id : 3 , name : "Item 3" } ,
363
363
{ id : 5 , name : "Item 5" } ,
364
364
] ;
365
- const diff = streamListDiffClient ( prevList , nextList , "id" , {
365
+ const diff = streamListDiff ( prevList , nextList , "id" , {
366
366
chunksSize : 5 ,
367
367
considerMoveAsUpdate : true ,
368
368
} ) ;
@@ -434,7 +434,7 @@ describe("data emission", () => {
434
434
{ id : 3 , name : "Item 3" } ,
435
435
{ id : 5 , name : "Item 5" } ,
436
436
] ;
437
- const diff = streamListDiffClient ( prevList , nextList , "id" , {
437
+ const diff = streamListDiff ( prevList , nextList , "id" , {
438
438
chunksSize : 5 ,
439
439
showOnly : [ "added" , "deleted" ] ,
440
440
} ) ;
@@ -522,7 +522,7 @@ describe("data emission", () => {
522
522
{ id : 9 , name : "Item 9" } ,
523
523
{ id : 8 , name : "Item 8" } ,
524
524
] ;
525
- const diff = streamListDiffClient ( prevList , nextList , "id" , {
525
+ const diff = streamListDiff ( prevList , nextList , "id" , {
526
526
chunksSize : 5 ,
527
527
} ) ;
528
528
@@ -751,7 +751,7 @@ describe("input handling", () => {
751
751
} ,
752
752
} ) ;
753
753
754
- const diff = streamListDiffClient ( prevStream , nextStream , "id" , {
754
+ const diff = streamListDiff ( prevStream , nextStream , "id" , {
755
755
chunksSize : 5 ,
756
756
} ) ;
757
757
@@ -775,7 +775,7 @@ describe("input handling", () => {
775
775
type : "application/json" ,
776
776
} ) ;
777
777
778
- const diff = streamListDiffClient ( prevFile , nextFile , "id" , {
778
+ const diff = streamListDiff ( prevFile , nextFile , "id" , {
779
779
chunksSize : 5 ,
780
780
} ) ;
781
781
@@ -801,7 +801,7 @@ describe("input handling", () => {
801
801
type : "application/json" ,
802
802
} ) ;
803
803
804
- const diff = streamListDiffClient ( prevStream , nextFile , "id" , {
804
+ const diff = streamListDiff ( prevStream , nextFile , "id" , {
805
805
chunksSize : 5 ,
806
806
} ) ;
807
807
@@ -824,7 +824,7 @@ describe("input handling", () => {
824
824
} ,
825
825
} ) ;
826
826
827
- const diff = streamListDiffClient ( prevStream , nextList , "id" , {
827
+ const diff = streamListDiff ( prevStream , nextList , "id" , {
828
828
chunksSize : 5 ,
829
829
} ) ;
830
830
@@ -844,7 +844,7 @@ describe("input handling", () => {
844
844
type : "application/json" ,
845
845
} ) ;
846
846
847
- const diff = streamListDiffClient ( prevFile , nextList , "id" , {
847
+ const diff = streamListDiff ( prevFile , nextList , "id" , {
848
848
chunksSize : 5 ,
849
849
} ) ;
850
850
@@ -863,7 +863,7 @@ describe("input handling", () => {
863
863
864
864
describe ( "finish event" , ( ) => {
865
865
it ( "emits 'finish' event if no prevList nor nextList is provided" , ( done ) => {
866
- const diff = streamListDiffClient ( [ ] , [ ] , "id" ) ;
866
+ const diff = streamListDiff ( [ ] , [ ] , "id" ) ;
867
867
diff . on ( "finish" , ( ) => done ( ) ) ;
868
868
} ) ;
869
869
it ( "emits 'finish' event when all the chunks have been processed" , ( done ) => {
@@ -875,7 +875,7 @@ describe("finish event", () => {
875
875
{ id : 2 , name : "Item 2" } ,
876
876
{ id : 3 , name : "Item 3" } ,
877
877
] ;
878
- const diff = streamListDiffClient ( prevList , nextList , "id" ) ;
878
+ const diff = streamListDiff ( prevList , nextList , "id" ) ;
879
879
diff . on ( "finish" , ( ) => done ( ) ) ;
880
880
} ) ;
881
881
} ) ;
@@ -893,7 +893,7 @@ describe("error event", () => {
893
893
] ;
894
894
895
895
// @ts -expect-error prevList is invalid by design for the test
896
- const diff = streamListDiffClient ( prevList , nextList , "id" ) ;
896
+ const diff = streamListDiff ( prevList , nextList , "id" ) ;
897
897
898
898
diff . on ( "error" , ( err ) => {
899
899
expect ( err [ "message" ] ) . toEqual (
@@ -915,7 +915,7 @@ describe("error event", () => {
915
915
] ;
916
916
917
917
// @ts -expect-error nextList is invalid by design for the test
918
- const diff = streamListDiffClient ( prevList , nextList , "id" ) ;
918
+ const diff = streamListDiff ( prevList , nextList , "id" ) ;
919
919
920
920
diff . on ( "error" , ( err ) => {
921
921
expect ( err [ "message" ] ) . toEqual (
@@ -932,7 +932,7 @@ describe("error event", () => {
932
932
{ id : 2 , name : "Item 2" } ,
933
933
] ;
934
934
935
- const diff = streamListDiffClient ( prevList , nextList , "id" ) ;
935
+ const diff = streamListDiff ( prevList , nextList , "id" ) ;
936
936
937
937
diff . on ( "error" , ( err ) => {
938
938
expect ( err [ "message" ] ) . toEqual (
@@ -949,7 +949,7 @@ describe("error event", () => {
949
949
] ;
950
950
const nextList = [ { id : 1 , name : "Item 1" } , { name : "Item 2" } ] ;
951
951
952
- const diff = streamListDiffClient ( prevList , nextList , "id" ) ;
952
+ const diff = streamListDiff ( prevList , nextList , "id" ) ;
953
953
954
954
diff . on ( "error" , ( err ) => {
955
955
expect ( err [ "message" ] ) . toEqual (
@@ -966,7 +966,7 @@ describe("error event", () => {
966
966
] ;
967
967
const nextList = [ { id : 1 , name : "Item 1" } , { name : "Item 2" } ] ;
968
968
969
- const diff = streamListDiffClient ( prevList , nextList , "id" , {
969
+ const diff = streamListDiff ( prevList , nextList , "id" , {
970
970
chunksSize : - 3 ,
971
971
} ) ;
972
972
@@ -982,7 +982,7 @@ describe("error event", () => {
982
982
const nextList = [ { id : 1 , name : "Item 1" } , { name : "Item 2" } ] ;
983
983
984
984
// @ts -expect-error - prevList is invalid by design for the test
985
- const diff = streamListDiffClient ( { name : "hello" } , nextList , "id" ) ;
985
+ const diff = streamListDiff ( { name : "hello" } , nextList , "id" ) ;
986
986
987
987
diff . on ( "error" , ( err ) => {
988
988
expect ( err [ "message" ] ) . toEqual (
@@ -995,7 +995,7 @@ describe("error event", () => {
995
995
const prevList = [ { id : 1 , name : "Item 1" } , { name : "Item 2" } ] ;
996
996
997
997
// @ts -expect-error - nextList is invalid by design for the test
998
- const diff = streamListDiffClient ( prevList , null , "id" ) ;
998
+ const diff = streamListDiff ( prevList , null , "id" ) ;
999
999
1000
1000
diff . on ( "error" , ( err ) => {
1001
1001
expect ( err [ "message" ] ) . toEqual (
@@ -1025,7 +1025,7 @@ describe("performance", () => {
1025
1025
nextList [ 20_000 ] . value = "updated-value-20000" ; // Another updated entry
1026
1026
nextList . push ( { id : numEntries , value : `new-value-${ numEntries } ` } ) ; // 1 added entry
1027
1027
1028
- const diffListener = streamListDiffClient < { id : number ; value : string } > (
1028
+ const diffListener = streamListDiff < { id : number ; value : string } > (
1029
1029
prevList ,
1030
1030
nextList ,
1031
1031
"id" ,
0 commit comments