@ -1,6 +1,6 @@
@@ -1,6 +1,6 @@
import path from "path" ;
import { Readable } from "stream" ;
import { LIST_STATUS } from "@models/list" ;
import { ListStatus } from "@models/list" ;
import { StreamListDiff } from "@models/stream" ;
import { streamListDiff } from "." ;
@ -10,7 +10,10 @@ describe("data emission", () => {
@@ -10,7 +10,10 @@ describe("data emission", () => {
{ id : 1 , name : "Item 1" } ,
{ id : 2 , name : "Item 2" } ,
] ;
const diff = streamListDiff ( [ ] , nextList , "id" , { chunksSize : 2 } ) ;
const diff = streamListDiff ( [ ] , nextList , "id" , {
chunksSize : 2 ,
useWorker : false ,
} ) ;
const expectedChunks = [
{
@ -19,7 +22,7 @@ describe("data emission", () => {
@@ -19,7 +22,7 @@ describe("data emission", () => {
prevIndex : null ,
newIndex : 0 ,
indexDiff : null ,
status : LIST_STATUS .ADDED ,
status : ListStatus .ADDED ,
} ,
{
previousValue : null ,
@ -27,7 +30,7 @@ describe("data emission", () => {
@@ -27,7 +30,7 @@ describe("data emission", () => {
prevIndex : null ,
newIndex : 1 ,
indexDiff : null ,
status : LIST_STATUS .ADDED ,
status : ListStatus .ADDED ,
} ,
] ;
let chunkCount = 0 ;
@ -45,7 +48,10 @@ describe("data emission", () => {
@@ -45,7 +48,10 @@ describe("data emission", () => {
{ id : 1 , name : "Item 1" } ,
{ id : 2 , name : "Item 2" } ,
] ;
const diff = streamListDiff ( prevList , [ ] , "id" , { chunksSize : 2 } ) ;
const diff = streamListDiff ( prevList , [ ] , "id" , {
chunksSize : 2 ,
useWorker : false ,
} ) ;
const expectedChunks = [
{
@ -54,7 +60,7 @@ describe("data emission", () => {
@@ -54,7 +60,7 @@ describe("data emission", () => {
prevIndex : 0 ,
newIndex : null ,
indexDiff : null ,
status : LIST_STATUS .DELETED ,
status : ListStatus .DELETED ,
} ,
{
previousValue : { id : 2 , name : "Item 2" } ,
@ -62,7 +68,7 @@ describe("data emission", () => {
@@ -62,7 +68,7 @@ describe("data emission", () => {
prevIndex : 1 ,
newIndex : null ,
indexDiff : null ,
status : LIST_STATUS .DELETED ,
status : ListStatus .DELETED ,
} ,
] ;
let chunkCount = 0 ;
@ -70,7 +76,7 @@ describe("data emission", () => {
@@ -70,7 +76,7 @@ describe("data emission", () => {
expect ( chunk ) . toStrictEqual ( expectedChunks ) ;
chunkCount ++ ;
} ) ;
diff . on ( "error" , ( err ) = > console . error ( "shiiiite" , err ) ) ;
diff . on ( "error" , ( err ) = > console . error ( err ) ) ;
diff . on ( "finish" , ( ) = > {
expect ( chunkCount ) . toBe ( 1 ) ;
done ( ) ;
@ -85,7 +91,7 @@ describe("data emission", () => {
@@ -85,7 +91,7 @@ describe("data emission", () => {
{ id : 2 , name : "Item 2" } ,
{ id : 3 , name : "Item 3" } ,
] ;
const diff = streamListDiff ( prevList , nextList , "id" ) ;
const diff = streamListDiff ( prevList , nextList , "id" , { useWorker : false } ) ;
const expectedChunks = [
[
@ -95,7 +101,7 @@ describe("data emission", () => {
@@ -95,7 +101,7 @@ describe("data emission", () => {
prevIndex : 1 ,
newIndex : 0 ,
indexDiff : - 1 ,
status : LIST_STATUS .MOVED ,
status : ListStatus .MOVED ,
} ,
] ,
[
@ -105,7 +111,7 @@ describe("data emission", () => {
@@ -105,7 +111,7 @@ describe("data emission", () => {
prevIndex : 0 ,
newIndex : null ,
indexDiff : null ,
status : LIST_STATUS .DELETED ,
status : ListStatus .DELETED ,
} ,
] ,
[
@ -115,7 +121,7 @@ describe("data emission", () => {
@@ -115,7 +121,7 @@ describe("data emission", () => {
prevIndex : null ,
newIndex : 1 ,
indexDiff : null ,
status : LIST_STATUS .ADDED ,
status : ListStatus .ADDED ,
} ,
] ,
] ;
@ -158,6 +164,7 @@ describe("data emission", () => {
@@ -158,6 +164,7 @@ describe("data emission", () => {
] ;
const diff = streamListDiff ( prevList , nextList , "id" , {
chunksSize : 5 ,
useWorker : false ,
} ) ;
const expectedChunks = [
@ -168,7 +175,7 @@ describe("data emission", () => {
@@ -168,7 +175,7 @@ describe("data emission", () => {
prevIndex : 0 ,
newIndex : 0 ,
indexDiff : 0 ,
status : LIST_STATUS .EQUAL ,
status : ListStatus .EQUAL ,
} ,
{
previousValue : { id : 2 , name : "Item 2" } ,
@ -176,7 +183,7 @@ describe("data emission", () => {
@@ -176,7 +183,7 @@ describe("data emission", () => {
prevIndex : 1 ,
newIndex : 1 ,
indexDiff : 0 ,
status : LIST_STATUS .UPDATED ,
status : ListStatus .UPDATED ,
} ,
{
previousValue : { id : 3 , name : "Item 3" } ,
@ -184,7 +191,7 @@ describe("data emission", () => {
@@ -184,7 +191,7 @@ describe("data emission", () => {
prevIndex : 2 ,
newIndex : 2 ,
indexDiff : 0 ,
status : LIST_STATUS .EQUAL ,
status : ListStatus .EQUAL ,
} ,
{
previousValue : { id : 5 , name : "Item 5" } ,
@ -192,7 +199,7 @@ describe("data emission", () => {
@@ -192,7 +199,7 @@ describe("data emission", () => {
prevIndex : 4 ,
newIndex : 3 ,
indexDiff : - 1 ,
status : LIST_STATUS .MOVED ,
status : ListStatus .MOVED ,
} ,
{
previousValue : { id : 6 , name : "Item 6" } ,
@ -200,7 +207,7 @@ describe("data emission", () => {
@@ -200,7 +207,7 @@ describe("data emission", () => {
prevIndex : 5 ,
newIndex : 4 ,
indexDiff : - 1 ,
status : LIST_STATUS .UPDATED ,
status : ListStatus .UPDATED ,
} ,
] ,
[
@ -210,7 +217,7 @@ describe("data emission", () => {
@@ -210,7 +217,7 @@ describe("data emission", () => {
prevIndex : 6 ,
newIndex : 5 ,
indexDiff : - 1 ,
status : LIST_STATUS .MOVED ,
status : ListStatus .MOVED ,
} ,
{
previousValue : { id : 9 , name : "Item 9" } ,
@ -218,7 +225,7 @@ describe("data emission", () => {
@@ -218,7 +225,7 @@ describe("data emission", () => {
prevIndex : 8 ,
newIndex : 8 ,
indexDiff : 0 ,
status : LIST_STATUS .EQUAL ,
status : ListStatus .EQUAL ,
} ,
{
previousValue : { id : 10 , name : "Item 10" } ,
@ -226,7 +233,7 @@ describe("data emission", () => {
@@ -226,7 +233,7 @@ describe("data emission", () => {
prevIndex : 9 ,
newIndex : 6 ,
indexDiff : - 3 ,
status : LIST_STATUS .MOVED ,
status : ListStatus .MOVED ,
} ,
{
previousValue : { id : 8 , name : "Item 8" } ,
@ -234,7 +241,7 @@ describe("data emission", () => {
@@ -234,7 +241,7 @@ describe("data emission", () => {
prevIndex : 7 ,
newIndex : 9 ,
indexDiff : 2 ,
status : LIST_STATUS .MOVED ,
status : ListStatus .MOVED ,
} ,
{
previousValue : { id : 4 , name : "Item 4" } ,
@ -242,7 +249,7 @@ describe("data emission", () => {
@@ -242,7 +249,7 @@ describe("data emission", () => {
prevIndex : 3 ,
newIndex : null ,
indexDiff : null ,
status : LIST_STATUS .DELETED ,
status : ListStatus .DELETED ,
} ,
] ,
[
@ -252,7 +259,7 @@ describe("data emission", () => {
@@ -252,7 +259,7 @@ describe("data emission", () => {
prevIndex : null ,
newIndex : 7 ,
indexDiff : null ,
status : LIST_STATUS .ADDED ,
status : ListStatus .ADDED ,
} ,
] ,
] ;
@ -286,6 +293,7 @@ describe("data emission", () => {
@@ -286,6 +293,7 @@ describe("data emission", () => {
const diff = streamListDiff ( prevList , nextList , "id" , {
chunksSize : 5 ,
useWorker : false ,
} ) ;
const expectedChunks = [
@ -295,7 +303,7 @@ describe("data emission", () => {
@@ -295,7 +303,7 @@ describe("data emission", () => {
prevIndex : 0 ,
newIndex : 0 ,
indexDiff : 0 ,
status : LIST_STATUS .EQUAL ,
status : ListStatus .EQUAL ,
} ,
{
previousValue : { id : 2 , name : "Item 2" } ,
@ -303,7 +311,7 @@ describe("data emission", () => {
@@ -303,7 +311,7 @@ describe("data emission", () => {
prevIndex : 1 ,
newIndex : 1 ,
indexDiff : 0 ,
status : LIST_STATUS .UPDATED ,
status : ListStatus .UPDATED ,
} ,
{
previousValue : { id : 3 , name : "Item 3" } ,
@ -311,7 +319,7 @@ describe("data emission", () => {
@@ -311,7 +319,7 @@ describe("data emission", () => {
prevIndex : 2 ,
newIndex : 2 ,
indexDiff : 0 ,
status : LIST_STATUS .EQUAL ,
status : ListStatus .EQUAL ,
} ,
{
previousValue : { id : 4 , name : "Item 4" } ,
@ -319,7 +327,7 @@ describe("data emission", () => {
@@ -319,7 +327,7 @@ describe("data emission", () => {
prevIndex : 3 ,
newIndex : null ,
indexDiff : null ,
status : LIST_STATUS .DELETED ,
status : ListStatus .DELETED ,
} ,
{
previousValue : null ,
@ -327,7 +335,7 @@ describe("data emission", () => {
@@ -327,7 +335,7 @@ describe("data emission", () => {
prevIndex : null ,
newIndex : 3 ,
indexDiff : null ,
status : LIST_STATUS .ADDED ,
status : ListStatus .ADDED ,
} ,
] ;
@ -336,7 +344,7 @@ describe("data emission", () => {
@@ -336,7 +344,7 @@ describe("data emission", () => {
expect ( chunk ) . toStrictEqual ( expectedChunks ) ;
chunkCount ++ ;
} ) ;
diff . on ( "error" , ( err ) = > console . error ( "sheeeet" , err ) ) ;
diff . on ( "error" , ( err ) = > console . error ( err ) ) ;
diff . on ( "finish" , ( ) = > {
expect ( chunkCount ) . toBe ( 1 ) ;
done ( ) ;
@ -358,6 +366,7 @@ describe("data emission", () => {
@@ -358,6 +366,7 @@ describe("data emission", () => {
const diff = streamListDiff ( prevList , nextList , "id" , {
chunksSize : 5 ,
considerMoveAsUpdate : true ,
useWorker : false ,
} ) ;
const expectedChunks = [
@ -367,7 +376,7 @@ describe("data emission", () => {
@@ -367,7 +376,7 @@ describe("data emission", () => {
prevIndex : 1 ,
newIndex : 0 ,
indexDiff : - 1 ,
status : LIST_STATUS .UPDATED ,
status : ListStatus .UPDATED ,
} ,
{
previousValue : { id : 1 , name : "Item 1" } ,
@ -375,7 +384,7 @@ describe("data emission", () => {
@@ -375,7 +384,7 @@ describe("data emission", () => {
prevIndex : 0 ,
newIndex : 1 ,
indexDiff : 1 ,
status : LIST_STATUS .UPDATED ,
status : ListStatus .UPDATED ,
} ,
{
previousValue : { id : 3 , name : "Item 3" } ,
@ -383,7 +392,7 @@ describe("data emission", () => {
@@ -383,7 +392,7 @@ describe("data emission", () => {
prevIndex : 2 ,
newIndex : 2 ,
indexDiff : 0 ,
status : LIST_STATUS .EQUAL ,
status : ListStatus .EQUAL ,
} ,
{
previousValue : { id : 4 , name : "Item 4" } ,
@ -391,7 +400,7 @@ describe("data emission", () => {
@@ -391,7 +400,7 @@ describe("data emission", () => {
prevIndex : 3 ,
newIndex : null ,
indexDiff : null ,
status : LIST_STATUS .DELETED ,
status : ListStatus .DELETED ,
} ,
{
previousValue : null ,
@ -399,7 +408,7 @@ describe("data emission", () => {
@@ -399,7 +408,7 @@ describe("data emission", () => {
prevIndex : null ,
newIndex : 3 ,
indexDiff : null ,
status : LIST_STATUS .ADDED ,
status : ListStatus .ADDED ,
} ,
] ;
@ -430,6 +439,7 @@ describe("data emission", () => {
@@ -430,6 +439,7 @@ describe("data emission", () => {
const diff = streamListDiff ( prevList , nextList , "id" , {
chunksSize : 5 ,
showOnly : [ "added" , "deleted" ] ,
useWorker : false ,
} ) ;
const expectedChunks = [
@ -439,7 +449,7 @@ describe("data emission", () => {
@@ -439,7 +449,7 @@ describe("data emission", () => {
prevIndex : 3 ,
newIndex : null ,
indexDiff : null ,
status : LIST_STATUS .DELETED ,
status : ListStatus .DELETED ,
} ,
{
previousValue : null ,
@ -447,7 +457,7 @@ describe("data emission", () => {
@@ -447,7 +457,7 @@ describe("data emission", () => {
prevIndex : null ,
newIndex : 3 ,
indexDiff : null ,
status : LIST_STATUS .ADDED ,
status : ListStatus .ADDED ,
} ,
] ;
@ -517,6 +527,7 @@ describe("data emission", () => {
@@ -517,6 +527,7 @@ describe("data emission", () => {
] ;
const diff = streamListDiff ( prevList , nextList , "id" , {
chunksSize : 5 ,
useWorker : false ,
} ) ;
const expectedChunks = [
@ -535,7 +546,7 @@ describe("data emission", () => {
@@ -535,7 +546,7 @@ describe("data emission", () => {
prevIndex : 0 ,
newIndex : 0 ,
indexDiff : 0 ,
status : LIST_STATUS .EQUAL ,
status : ListStatus .EQUAL ,
} ,
{
previousValue : { id : 2 , name : "Item 2" } ,
@ -543,7 +554,7 @@ describe("data emission", () => {
@@ -543,7 +554,7 @@ describe("data emission", () => {
prevIndex : 1 ,
newIndex : 1 ,
indexDiff : 0 ,
status : LIST_STATUS .UPDATED ,
status : ListStatus .UPDATED ,
} ,
{
previousValue : {
@ -559,7 +570,7 @@ describe("data emission", () => {
@@ -559,7 +570,7 @@ describe("data emission", () => {
prevIndex : 2 ,
newIndex : 2 ,
indexDiff : 0 ,
status : LIST_STATUS .EQUAL ,
status : ListStatus .EQUAL ,
} ,
{
previousValue : { id : 5 , name : "Item 5" } ,
@ -567,7 +578,7 @@ describe("data emission", () => {
@@ -567,7 +578,7 @@ describe("data emission", () => {
prevIndex : 4 ,
newIndex : 3 ,
indexDiff : - 1 ,
status : LIST_STATUS .MOVED ,
status : ListStatus .MOVED ,
} ,
{
previousValue : {
@ -583,7 +594,7 @@ describe("data emission", () => {
@@ -583,7 +594,7 @@ describe("data emission", () => {
prevIndex : 5 ,
newIndex : 4 ,
indexDiff : - 1 ,
status : LIST_STATUS .UPDATED ,
status : ListStatus .UPDATED ,
} ,
] ,
[
@ -593,7 +604,7 @@ describe("data emission", () => {
@@ -593,7 +604,7 @@ describe("data emission", () => {
prevIndex : 6 ,
newIndex : 5 ,
indexDiff : - 1 ,
status : LIST_STATUS .MOVED ,
status : ListStatus .MOVED ,
} ,
{
previousValue : { id : 9 , name : "Item 9" } ,
@ -601,7 +612,7 @@ describe("data emission", () => {
@@ -601,7 +612,7 @@ describe("data emission", () => {
prevIndex : 8 ,
newIndex : 8 ,
indexDiff : 0 ,
status : LIST_STATUS .EQUAL ,
status : ListStatus .EQUAL ,
} ,
{
previousValue : {
@ -625,7 +636,7 @@ describe("data emission", () => {
@@ -625,7 +636,7 @@ describe("data emission", () => {
prevIndex : 9 ,
newIndex : 6 ,
indexDiff : - 3 ,
status : LIST_STATUS .MOVED ,
status : ListStatus .MOVED ,
} ,
{
previousValue : { id : 8 , name : "Item 8" } ,
@ -633,7 +644,7 @@ describe("data emission", () => {
@@ -633,7 +644,7 @@ describe("data emission", () => {
prevIndex : 7 ,
newIndex : 9 ,
indexDiff : 2 ,
status : LIST_STATUS .MOVED ,
status : ListStatus .MOVED ,
} ,
{
previousValue : {
@ -645,7 +656,7 @@ describe("data emission", () => {
@@ -645,7 +656,7 @@ describe("data emission", () => {
prevIndex : 3 ,
newIndex : null ,
indexDiff : null ,
status : LIST_STATUS .DELETED ,
status : ListStatus .DELETED ,
} ,
] ,
[
@ -655,7 +666,7 @@ describe("data emission", () => {
@@ -655,7 +666,7 @@ describe("data emission", () => {
prevIndex : null ,
newIndex : 7 ,
indexDiff : null ,
status : LIST_STATUS .ADDED ,
status : ListStatus .ADDED ,
} ,
] ,
] ;
@ -694,7 +705,7 @@ describe("input handling", () => {
@@ -694,7 +705,7 @@ describe("input handling", () => {
prevIndex : 0 ,
newIndex : 0 ,
indexDiff : 0 ,
status : LIST_STATUS .EQUAL ,
status : ListStatus .EQUAL ,
} ,
{
previousValue : { id : 2 , name : "Item 2" } ,
@ -702,7 +713,7 @@ describe("input handling", () => {
@@ -702,7 +713,7 @@ describe("input handling", () => {
prevIndex : 1 ,
newIndex : 1 ,
indexDiff : 0 ,
status : LIST_STATUS .UPDATED ,
status : ListStatus .UPDATED ,
} ,
{
previousValue : { id : 3 , name : "Item 3" } ,
@ -710,7 +721,7 @@ describe("input handling", () => {
@@ -710,7 +721,7 @@ describe("input handling", () => {
prevIndex : 2 ,
newIndex : 2 ,
indexDiff : 0 ,
status : LIST_STATUS .EQUAL ,
status : ListStatus .EQUAL ,
} ,
{
previousValue : { id : 4 , name : "Item 4" } ,
@ -718,7 +729,7 @@ describe("input handling", () => {
@@ -718,7 +729,7 @@ describe("input handling", () => {
prevIndex : 3 ,
newIndex : null ,
indexDiff : null ,
status : LIST_STATUS .DELETED ,
status : ListStatus .DELETED ,
} ,
{
previousValue : null ,
@ -726,7 +737,7 @@ describe("input handling", () => {
@@ -726,7 +737,7 @@ describe("input handling", () => {
prevIndex : null ,
newIndex : 3 ,
indexDiff : null ,
status : LIST_STATUS .ADDED ,
status : ListStatus .ADDED ,
} ,
] ;
@ -736,6 +747,7 @@ describe("input handling", () => {
@@ -736,6 +747,7 @@ describe("input handling", () => {
const diff = streamListDiff ( prevStream , nextStream , "id" , {
chunksSize : 5 ,
useWorker : false ,
} ) ;
let chunkCount = 0 ;
@ -743,7 +755,7 @@ describe("input handling", () => {
@@ -743,7 +755,7 @@ describe("input handling", () => {
expect ( chunk ) . toStrictEqual ( expectedChunks ) ;
chunkCount ++ ;
} ) ;
diff . on ( "error" , ( err ) = > console . error ( "sheeeet" , err ) ) ;
diff . on ( "error" , ( err ) = > console . error ( err ) ) ;
diff . on ( "finish" , ( ) = > {
expect ( chunkCount ) . toBe ( 1 ) ;
done ( ) ;
@ -755,6 +767,7 @@ describe("input handling", () => {
@@ -755,6 +767,7 @@ describe("input handling", () => {
const diff = streamListDiff ( prevFile , nextFile , "id" , {
chunksSize : 5 ,
useWorker : false ,
} ) ;
let chunkCount = 0 ;
@ -762,7 +775,7 @@ describe("input handling", () => {
@@ -762,7 +775,7 @@ describe("input handling", () => {
expect ( chunk ) . toStrictEqual ( expectedChunks ) ;
chunkCount ++ ;
} ) ;
diff . on ( "error" , ( err ) = > console . error ( "sheeeet" , err ) ) ;
diff . on ( "error" , ( err ) = > console . error ( err ) ) ;
diff . on ( "finish" , ( ) = > {
expect ( chunkCount ) . toBe ( 1 ) ;
done ( ) ;
@ -774,6 +787,7 @@ describe("input handling", () => {
@@ -774,6 +787,7 @@ describe("input handling", () => {
const diff = streamListDiff ( prevStream , nextFile , "id" , {
chunksSize : 5 ,
useWorker : false ,
} ) ;
let chunkCount = 0 ;
@ -781,7 +795,7 @@ describe("input handling", () => {
@@ -781,7 +795,7 @@ describe("input handling", () => {
expect ( chunk ) . toStrictEqual ( expectedChunks ) ;
chunkCount ++ ;
} ) ;
diff . on ( "error" , ( err ) = > console . error ( "sheeeet" , err ) ) ;
diff . on ( "error" , ( err ) = > console . error ( err ) ) ;
diff . on ( "finish" , ( ) = > {
expect ( chunkCount ) . toBe ( 1 ) ;
done ( ) ;
@ -792,6 +806,7 @@ describe("input handling", () => {
@@ -792,6 +806,7 @@ describe("input handling", () => {
const diff = streamListDiff ( prevStream , nextList , "id" , {
chunksSize : 5 ,
useWorker : false ,
} ) ;
let chunkCount = 0 ;
@ -799,7 +814,7 @@ describe("input handling", () => {
@@ -799,7 +814,7 @@ describe("input handling", () => {
expect ( chunk ) . toStrictEqual ( expectedChunks ) ;
chunkCount ++ ;
} ) ;
diff . on ( "error" , ( err ) = > console . error ( "sheeeet" , err ) ) ;
diff . on ( "error" , ( err ) = > console . error ( err ) ) ;
diff . on ( "finish" , ( ) = > {
expect ( chunkCount ) . toBe ( 1 ) ;
done ( ) ;
@ -810,6 +825,7 @@ describe("input handling", () => {
@@ -810,6 +825,7 @@ describe("input handling", () => {
const diff = streamListDiff ( prevFile , nextList , "id" , {
chunksSize : 5 ,
useWorker : false ,
} ) ;
let chunkCount = 0 ;
@ -817,7 +833,7 @@ describe("input handling", () => {
@@ -817,7 +833,7 @@ describe("input handling", () => {
expect ( chunk ) . toStrictEqual ( expectedChunks ) ;
chunkCount ++ ;
} ) ;
diff . on ( "error" , ( err ) = > console . error ( "sheeeet" , err ) ) ;
diff . on ( "error" , ( err ) = > console . error ( err ) ) ;
diff . on ( "finish" , ( ) = > {
expect ( chunkCount ) . toBe ( 1 ) ;
done ( ) ;
@ -827,7 +843,7 @@ describe("input handling", () => {
@@ -827,7 +843,7 @@ describe("input handling", () => {
describe ( "finish event" , ( ) = > {
it ( "emits 'finish' event if no prevList nor nextList is provided" , ( done ) = > {
const diff = streamListDiff ( [ ] , [ ] , "id" ) ;
const diff = streamListDiff ( [ ] , [ ] , "id" , { useWorker : false } ) ;
diff . on ( "finish" , ( ) = > done ( ) ) ;
} ) ;
it ( "emits 'finish' event when all the chunks have been processed" , ( done ) = > {
@ -839,7 +855,7 @@ describe("finish event", () => {
@@ -839,7 +855,7 @@ describe("finish event", () => {
{ id : 2 , name : "Item 2" } ,
{ id : 3 , name : "Item 3" } ,
] ;
const diff = streamListDiff ( prevList , nextList , "id" ) ;
const diff = streamListDiff ( prevList , nextList , "id" , { useWorker : false } ) ;
diff . on ( "finish" , ( ) = > done ( ) ) ;
} ) ;
} ) ;
@ -857,7 +873,7 @@ describe("error event", () => {
@@ -857,7 +873,7 @@ describe("error event", () => {
] ;
// @ts-expect-error prevList is invalid by design for the test
const diff = streamListDiff ( prevList , nextList , "id" ) ;
const diff = streamListDiff ( prevList , nextList , "id" , { useWorker : false } ) ;
diff . on ( "error" , ( err ) = > {
expect ( err [ "message" ] ) . toEqual (
@ -879,7 +895,7 @@ describe("error event", () => {
@@ -879,7 +895,7 @@ describe("error event", () => {
] ;
// @ts-expect-error nextList is invalid by design for the test
const diff = streamListDiff ( prevList , nextList , "id" ) ;
const diff = streamListDiff ( prevList , nextList , "id" , { useWorker : false } ) ;
diff . on ( "error" , ( err ) = > {
expect ( err [ "message" ] ) . toEqual (
@ -896,7 +912,7 @@ describe("error event", () => {
@@ -896,7 +912,7 @@ describe("error event", () => {
{ id : 2 , name : "Item 2" } ,
] ;
const diff = streamListDiff ( prevList , nextList , "id" ) ;
const diff = streamListDiff ( prevList , nextList , "id" , { useWorker : false } ) ;
diff . on ( "error" , ( err ) = > {
expect ( err [ "message" ] ) . toEqual (
@ -913,7 +929,7 @@ describe("error event", () => {
@@ -913,7 +929,7 @@ describe("error event", () => {
] ;
const nextList = [ { id : 1 , name : "Item 1" } , { name : "Item 2" } ] ;
const diff = streamListDiff ( prevList , nextList , "id" ) ;
const diff = streamListDiff ( prevList , nextList , "id" , { useWorker : false } ) ;
diff . on ( "error" , ( err ) = > {
expect ( err [ "message" ] ) . toEqual (
@ -932,6 +948,7 @@ describe("error event", () => {
@@ -932,6 +948,7 @@ describe("error event", () => {
const diff = streamListDiff ( prevList , nextList , "id" , {
chunksSize : - 3 ,
useWorker : false ,
} ) ;
diff . on ( "error" , ( err ) = > {
@ -946,7 +963,9 @@ describe("error event", () => {
@@ -946,7 +963,9 @@ describe("error event", () => {
const nextList = [ { id : 1 , name : "Item 1" } , { name : "Item 2" } ] ;
// @ts-expect-error - prevList is invalid by design for the test
const diff = streamListDiff ( { name : "hello" } , nextList , "id" ) ;
const diff = streamListDiff ( { name : "hello" } , nextList , "id" , {
useWorker : false ,
} ) ;
diff . on ( "error" , ( err ) = > {
expect ( err [ "message" ] ) . toEqual (
@ -959,7 +978,7 @@ describe("error event", () => {
@@ -959,7 +978,7 @@ describe("error event", () => {
const prevList = [ { id : 1 , name : "Item 1" } , { name : "Item 2" } ] ;
// @ts-expect-error - nextList is invalid by design for the test
const diff = streamListDiff ( prevList , null , "id" ) ;
const diff = streamListDiff ( prevList , null , "id" , { useWorker : false } ) ;
diff . on ( "error" , ( err ) = > {
expect ( err [ "message" ] ) . toEqual (