refactor: cleanup worker method typing
authorJérôme Benoit <jerome.benoit@sap.com>
Sat, 29 Jul 2023 10:34:48 +0000 (12:34 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Sat, 29 Jul 2023 10:34:48 +0000 (12:34 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/worker/thread-worker.ts
tests/circular-array.test.js

index ec5dea8ef74cc4a1dbac377f3f50eaad21c10b8f..dc628bed08fa4b23f29724f88f41484b0097afef 100644 (file)
@@ -67,7 +67,7 @@ export class ThreadWorker<
   }
 
   /** @inheritDoc */
-  protected handleKillMessage (message: MessageValue<Data, unknown>): void {
+  protected handleKillMessage (message: MessageValue<Data>): void {
     super.handleKillMessage(message)
     this.port?.unref()
     this.port?.close()
index d821b6cd8dabe39a02fd615aa8e85f7c3d2cdfcb..a86372349ca16ab0985e515cada42c5651904e8d 100644 (file)
@@ -133,6 +133,10 @@ describe('Circular array test suite', () => {
     expect(circularArray.size).toBe(0)
     expect(circularArray).toStrictEqual(new CircularArray(0))
     circularArray = new CircularArray(5, 1, 2, 3, 4, 5)
+    circularArray.resize(1)
+    expect(circularArray.size).toBe(1)
+    expect(circularArray).toStrictEqual(new CircularArray(1, 1))
+    circularArray = new CircularArray(5, 1, 2, 3, 4, 5)
     circularArray.resize(3)
     expect(circularArray.size).toBe(3)
     expect(circularArray).toStrictEqual(new CircularArray(3, 1, 2, 3))