Skip to content

Commit

Permalink
fix: increased sleep times to improve consistency of tests
Browse files Browse the repository at this point in the history
  • Loading branch information
oliver-oloughlin committed Nov 20, 2023
1 parent 5ad6f08 commit c31610f
Show file tree
Hide file tree
Showing 11 changed files with 45 additions and 45 deletions.
4 changes: 2 additions & 2 deletions tests/collection/enqueue.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions tests/collection/listenQueue.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -69,7 +69,7 @@ Deno.test("collection - listenQueue", async (t) => {

await db.enqueue("data")

await sleep(100)
await sleep(500)

assert(assertion)

Expand Down
4 changes: 2 additions & 2 deletions tests/db/enqueue.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions tests/db/listenQueue.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Deno.test("db - listenQueue", async (t) => {
__data__: data,
} as QueueMessage<QueueValue>)

await sleep(200)
await sleep(500)
assert(assertion)

return async () => await listener
Expand All @@ -52,7 +52,7 @@ Deno.test("db - listenQueue", async (t) => {

await db.numbers.enqueue(data)

await sleep(100)
await sleep(500)

assert(assertion)

Expand Down
4 changes: 2 additions & 2 deletions tests/indexable_collection/enqueue.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions tests/indexable_collection/listenQueue.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -70,7 +70,7 @@ Deno.test("indexable_collection - listenQueue", async (t) => {

await db.enqueue("data")

await sleep(100)
await sleep(500)

assert(assertion)

Expand Down
4 changes: 2 additions & 2 deletions tests/serialized_collection/enqueue.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions tests/serialized_collection/listenQueue.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -70,7 +70,7 @@ Deno.test("serialized_collection - listenQueue", async (t) => {

await db.enqueue("data")

await sleep(100)
await sleep(500)

assert(assertion)

Expand Down
50 changes: 25 additions & 25 deletions tests/serialized_collection/types.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ Deno.test("serialized_collection - types", async (t) => {
async () => {
await useKv(async (kv) => {
const db = kvdex(kv, {
nulls: collection(model<null>()),
undefineds: collection(model<undefined>()),
strings: collection(model<string>()),
numbers: collection(model<number>()),
bigints: collection(model<bigint>()),
u64s: collection(model<Deno.KvU64>()),
nulls: collection(model<null>(), { serialized: true }),
undefineds: collection(model<undefined>(), { serialized: true }),
strings: collection(model<string>(), { serialized: true }),
numbers: collection(model<number>(), { serialized: true }),
bigints: collection(model<bigint>(), { serialized: true }),
u64s: collection(model<Deno.KvU64>(), { serialized: true }),
})

const cr1 = await db.nulls.add(null)
Expand Down Expand Up @@ -49,12 +49,12 @@ Deno.test("serialized_collection - types", async (t) => {
async () => {
await useKv(async (kv) => {
const db = kvdex(kv, {
dates: collection(model<Date>()),
sets: collection(model<Set<string>>()),
maps: collection(model<Map<string, number>>()),
regExps: collection(model<RegExp>()),
dataVeiws: collection(model<DataView>()),
errors: collection(model<Error>()),
dates: collection(model<Date>(), { serialized: true }),
sets: collection(model<Set<string>>(), { serialized: true }),
maps: collection(model<Map<string, number>>(), { serialized: true }),
regExps: collection(model<RegExp>(), { serialized: true }),
dataVeiws: collection(model<DataView>(), { serialized: true }),
errors: collection(model<Error>(), { serialized: true }),
})

const cr1 = await db.dates.add(new Date())
Expand Down Expand Up @@ -103,19 +103,19 @@ Deno.test("serialized_collection - types", async (t) => {
async () => {
await useKv(async (kv) => {
const db = kvdex(kv, {
arrs: collection(model<Array<string>>()),
i8arrs: collection(model<Int8Array>()),
i16arrs: collection(model<Int16Array>()),
i32arrs: collection(model<Int32Array>()),
i64arrs: collection(model<BigInt64Array>()),
u8arrs: collection(model<Uint8Array>()),
u16arrs: collection(model<Uint16Array>()),
u32arrs: collection(model<Uint32Array>()),
u64arrs: collection(model<BigUint64Array>()),
u8carrs: collection(model<Uint8ClampedArray>()),
f32arrs: collection(model<Float32Array>()),
f64arrs: collection(model<Float64Array>()),
buffers: collection(model<ArrayBuffer>()),
arrs: collection(model<Array<string>>(), { serialized: true }),
i8arrs: collection(model<Int8Array>(), { serialized: true }),
i16arrs: collection(model<Int16Array>(), { serialized: true }),
i32arrs: collection(model<Int32Array>(), { serialized: true }),
i64arrs: collection(model<BigInt64Array>(), { serialized: true }),
u8arrs: collection(model<Uint8Array>(), { serialized: true }),
u16arrs: collection(model<Uint16Array>(), { serialized: true }),
u32arrs: collection(model<Uint32Array>(), { serialized: true }),
u64arrs: collection(model<BigUint64Array>(), { serialized: true }),
u8carrs: collection(model<Uint8ClampedArray>(), { serialized: true }),
f32arrs: collection(model<Float32Array>(), { serialized: true }),
f64arrs: collection(model<Float64Array>(), { serialized: true }),
buffers: collection(model<ArrayBuffer>(), { serialized: true }),
})

const cr1 = await db.arrs.add(["str1", "str2", "str3"])
Expand Down
4 changes: 2 additions & 2 deletions tests/serialized_indexable_collection/enqueue.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions tests/serialized_indexable_collection/listenQueue.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -70,7 +70,7 @@ Deno.test("serialized_indexable_collection - listenQueue", async (t) => {

await db.enqueue("data")

await sleep(100)
await sleep(500)

assert(assertion)

Expand Down

0 comments on commit c31610f

Please sign in to comment.