From c31610f10b9739e5169eda911b78305603902a3a Mon Sep 17 00:00:00 2001 From: oliver-oloughlin Date: Mon, 20 Nov 2023 20:44:26 +0100 Subject: [PATCH] fix: increased sleep times to improve consistency of tests --- tests/collection/enqueue.test.ts | 4 +- tests/collection/listenQueue.test.ts | 4 +- tests/db/enqueue.test.ts | 4 +- tests/db/listenQueue.test.ts | 4 +- tests/indexable_collection/enqueue.test.ts | 4 +- .../indexable_collection/listenQueue.test.ts | 4 +- tests/serialized_collection/enqueue.test.ts | 4 +- .../serialized_collection/listenQueue.test.ts | 4 +- tests/serialized_collection/types.test.ts | 50 +++++++++---------- .../enqueue.test.ts | 4 +- .../listenQueue.test.ts | 4 +- 11 files changed, 45 insertions(+), 45 deletions(-) diff --git a/tests/collection/enqueue.test.ts b/tests/collection/enqueue.test.ts index ef78e99..af4f963 100644 --- a/tests/collection/enqueue.test.ts +++ b/tests/collection/enqueue.test.ts @@ -32,7 +32,7 @@ Deno.test("collection - enqueue", async (t) => { idsIfUndelivered: [undeliveredId], }) - await sleep(100) + await sleep(500) const undelivered = await db.numbers.findUndelivered(undeliveredId) assert(assertion || typeof undelivered?.value === typeof data) @@ -59,7 +59,7 @@ Deno.test("collection - enqueue", async (t) => { topic, }) - await sleep(100) + await sleep(500) const undelivered = await db.users.findUndelivered(undeliveredId) assert(assertion1 || typeof undelivered?.value === typeof data) diff --git a/tests/collection/listenQueue.test.ts b/tests/collection/listenQueue.test.ts index d3ef5e5..7e2afbb 100644 --- a/tests/collection/listenQueue.test.ts +++ b/tests/collection/listenQueue.test.ts @@ -46,7 +46,7 @@ Deno.test("collection - listenQueue", async (t) => { ], }) - await sleep(100) + await sleep(500) const undelivered = await db.numbers.findUndelivered(undeliveredId) assert(assertion || typeof undelivered?.value === typeof data) @@ -69,7 +69,7 @@ Deno.test("collection - listenQueue", async (t) => { await db.enqueue("data") - await sleep(100) + await sleep(500) assert(assertion) diff --git a/tests/db/enqueue.test.ts b/tests/db/enqueue.test.ts index 6d0a04d..4b666a3 100644 --- a/tests/db/enqueue.test.ts +++ b/tests/db/enqueue.test.ts @@ -33,7 +33,7 @@ Deno.test("db - enqueue", async (t) => { idsIfUndelivered: [undeliveredId], }) - await sleep(100) + await sleep(500) const undelivered = await db.numbers.findUndelivered(undeliveredId) assert(assertion || typeof undelivered?.value === typeof data) @@ -64,7 +64,7 @@ Deno.test("db - enqueue", async (t) => { topic, }) - await sleep(100) + await sleep(500) const undelivered = await db.numbers.findUndelivered(undeliveredId) assert(assertion1 || typeof undelivered?.value === typeof data) diff --git a/tests/db/listenQueue.test.ts b/tests/db/listenQueue.test.ts index 11db772..2e8af06 100644 --- a/tests/db/listenQueue.test.ts +++ b/tests/db/listenQueue.test.ts @@ -29,7 +29,7 @@ Deno.test("db - listenQueue", async (t) => { __data__: data, } as QueueMessage) - await sleep(200) + await sleep(500) assert(assertion) return async () => await listener @@ -52,7 +52,7 @@ Deno.test("db - listenQueue", async (t) => { await db.numbers.enqueue(data) - await sleep(100) + await sleep(500) assert(assertion) diff --git a/tests/indexable_collection/enqueue.test.ts b/tests/indexable_collection/enqueue.test.ts index dd5105d..a44b141 100644 --- a/tests/indexable_collection/enqueue.test.ts +++ b/tests/indexable_collection/enqueue.test.ts @@ -33,7 +33,7 @@ Deno.test("indexable_collection - enqueue", async (t) => { idsIfUndelivered: [undeliveredId], }) - await sleep(100) + await sleep(500) const undelivered = await db.i_users.findUndelivered(undeliveredId) assert(assertion || typeof undelivered?.value === typeof data) @@ -60,7 +60,7 @@ Deno.test("indexable_collection - enqueue", async (t) => { topic, }) - await sleep(100) + await sleep(500) const undelivered = await db.i_users.findUndelivered(undeliveredId) assert(assertion1 || typeof undelivered?.value === typeof data) diff --git a/tests/indexable_collection/listenQueue.test.ts b/tests/indexable_collection/listenQueue.test.ts index b88765a..e111e6b 100644 --- a/tests/indexable_collection/listenQueue.test.ts +++ b/tests/indexable_collection/listenQueue.test.ts @@ -47,7 +47,7 @@ Deno.test("indexable_collection - listenQueue", async (t) => { ], }) - await sleep(100) + await sleep(500) const undelivered = await db.i_users.findUndelivered(undeliveredId) assert(assertion || typeof undelivered?.value === typeof data) @@ -70,7 +70,7 @@ Deno.test("indexable_collection - listenQueue", async (t) => { await db.enqueue("data") - await sleep(100) + await sleep(500) assert(assertion) diff --git a/tests/serialized_collection/enqueue.test.ts b/tests/serialized_collection/enqueue.test.ts index edc0944..e13b161 100644 --- a/tests/serialized_collection/enqueue.test.ts +++ b/tests/serialized_collection/enqueue.test.ts @@ -33,7 +33,7 @@ Deno.test("serialized_collection - enqueue", async (t) => { idsIfUndelivered: [undeliveredId], }) - await sleep(100) + await sleep(500) const undelivered = await db.s_users.findUndelivered(undeliveredId) assert(assertion || typeof undelivered?.value === typeof data) @@ -60,7 +60,7 @@ Deno.test("serialized_collection - enqueue", async (t) => { topic, }) - await sleep(100) + await sleep(500) const undelivered = await db.s_users.findUndelivered(undeliveredId) assert(assertion1 || typeof undelivered?.value === typeof data) diff --git a/tests/serialized_collection/listenQueue.test.ts b/tests/serialized_collection/listenQueue.test.ts index d96b2a8..94650c9 100644 --- a/tests/serialized_collection/listenQueue.test.ts +++ b/tests/serialized_collection/listenQueue.test.ts @@ -47,7 +47,7 @@ Deno.test("serialized_collection - listenQueue", async (t) => { ], }) - await sleep(100) + await sleep(500) const undelivered = await db.s_users.findUndelivered(undeliveredId) assert(assertion || typeof undelivered?.value === typeof data) @@ -70,7 +70,7 @@ Deno.test("serialized_collection - listenQueue", async (t) => { await db.enqueue("data") - await sleep(100) + await sleep(500) assert(assertion) diff --git a/tests/serialized_collection/types.test.ts b/tests/serialized_collection/types.test.ts index 1c9bbdc..23d7975 100644 --- a/tests/serialized_collection/types.test.ts +++ b/tests/serialized_collection/types.test.ts @@ -8,12 +8,12 @@ Deno.test("serialized_collection - types", async (t) => { async () => { await useKv(async (kv) => { const db = kvdex(kv, { - nulls: collection(model()), - undefineds: collection(model()), - strings: collection(model()), - numbers: collection(model()), - bigints: collection(model()), - u64s: collection(model()), + nulls: collection(model(), { serialized: true }), + undefineds: collection(model(), { serialized: true }), + strings: collection(model(), { serialized: true }), + numbers: collection(model(), { serialized: true }), + bigints: collection(model(), { serialized: true }), + u64s: collection(model(), { serialized: true }), }) const cr1 = await db.nulls.add(null) @@ -49,12 +49,12 @@ Deno.test("serialized_collection - types", async (t) => { async () => { await useKv(async (kv) => { const db = kvdex(kv, { - dates: collection(model()), - sets: collection(model>()), - maps: collection(model>()), - regExps: collection(model()), - dataVeiws: collection(model()), - errors: collection(model()), + dates: collection(model(), { serialized: true }), + sets: collection(model>(), { serialized: true }), + maps: collection(model>(), { serialized: true }), + regExps: collection(model(), { serialized: true }), + dataVeiws: collection(model(), { serialized: true }), + errors: collection(model(), { serialized: true }), }) const cr1 = await db.dates.add(new Date()) @@ -103,19 +103,19 @@ Deno.test("serialized_collection - types", async (t) => { async () => { await useKv(async (kv) => { const db = kvdex(kv, { - arrs: collection(model>()), - i8arrs: collection(model()), - i16arrs: collection(model()), - i32arrs: collection(model()), - i64arrs: collection(model()), - u8arrs: collection(model()), - u16arrs: collection(model()), - u32arrs: collection(model()), - u64arrs: collection(model()), - u8carrs: collection(model()), - f32arrs: collection(model()), - f64arrs: collection(model()), - buffers: collection(model()), + arrs: collection(model>(), { serialized: true }), + i8arrs: collection(model(), { serialized: true }), + i16arrs: collection(model(), { serialized: true }), + i32arrs: collection(model(), { serialized: true }), + i64arrs: collection(model(), { serialized: true }), + u8arrs: collection(model(), { serialized: true }), + u16arrs: collection(model(), { serialized: true }), + u32arrs: collection(model(), { serialized: true }), + u64arrs: collection(model(), { serialized: true }), + u8carrs: collection(model(), { serialized: true }), + f32arrs: collection(model(), { serialized: true }), + f64arrs: collection(model(), { serialized: true }), + buffers: collection(model(), { serialized: true }), }) const cr1 = await db.arrs.add(["str1", "str2", "str3"]) diff --git a/tests/serialized_indexable_collection/enqueue.test.ts b/tests/serialized_indexable_collection/enqueue.test.ts index 248f7c8..084fd73 100644 --- a/tests/serialized_indexable_collection/enqueue.test.ts +++ b/tests/serialized_indexable_collection/enqueue.test.ts @@ -33,7 +33,7 @@ Deno.test("serialized_indexable_collection - enqueue", async (t) => { idsIfUndelivered: [undeliveredId], }) - await sleep(100) + await sleep(500) const undelivered = await db.is_users.findUndelivered(undeliveredId) assert(assertion || typeof undelivered?.value === typeof data) @@ -60,7 +60,7 @@ Deno.test("serialized_indexable_collection - enqueue", async (t) => { topic, }) - await sleep(100) + await sleep(500) const undelivered = await db.i_users.findUndelivered(undeliveredId) assert(assertion1 || typeof undelivered?.value === typeof data) diff --git a/tests/serialized_indexable_collection/listenQueue.test.ts b/tests/serialized_indexable_collection/listenQueue.test.ts index 77e64ed..b1f0f6c 100644 --- a/tests/serialized_indexable_collection/listenQueue.test.ts +++ b/tests/serialized_indexable_collection/listenQueue.test.ts @@ -47,7 +47,7 @@ Deno.test("serialized_indexable_collection - listenQueue", async (t) => { ], }) - await sleep(100) + await sleep(500) const undelivered = await db.is_users.findUndelivered(undeliveredId) assert(assertion || typeof undelivered?.value === typeof data) @@ -70,7 +70,7 @@ Deno.test("serialized_indexable_collection - listenQueue", async (t) => { await db.enqueue("data") - await sleep(100) + await sleep(500) assert(assertion)