Fix db tests

This commit is contained in:
Alex Gleason 2025-02-16 00:39:00 -06:00
parent 773b5da461
commit 4e0bb16b85
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7
2 changed files with 7 additions and 2 deletions

View file

@ -2,9 +2,12 @@ import { assertEquals } from '@std/assert';
import { DittoPglite } from './DittoPglite.ts'; import { DittoPglite } from './DittoPglite.ts';
Deno.test('DittoPglite.create', () => { Deno.test('DittoPglite.create', async () => {
const db = DittoPglite.create('memory://'); const db = DittoPglite.create('memory://');
assertEquals(db.poolSize, 1); assertEquals(db.poolSize, 1);
assertEquals(db.availableConnections, 1); assertEquals(db.availableConnections, 1);
await db.kysely.destroy();
await new Promise((resolve) => setTimeout(resolve, 100));
}); });

View file

@ -7,8 +7,10 @@ Deno.test('isWorker from the main thread returns false', () => {
}); });
Deno.test('isWorker from a worker thread returns true', async () => { Deno.test('isWorker from a worker thread returns true', async () => {
const url = new URL('./worker.ts', import.meta.url);
const script = ` const script = `
import { isWorker } from '@/utils/worker.ts'; import { isWorker } from '${url.href}';
postMessage(isWorker()); postMessage(isWorker());
self.close(); self.close();
`; `;