fix sync package

This commit is contained in:
Nikita Sivukhin
2025-10-01 11:08:42 +04:00
parent 7869ac348e
commit 109b3c0609
9 changed files with 74 additions and 105 deletions

View File

@@ -1,8 +1,16 @@
import { expect, test } from 'vitest'
import { connect, DatabaseRowMutation, DatabaseRowTransformResult } from './promise-default.js'
import { Database, connect, DatabaseRowMutation, DatabaseRowTransformResult } from './promise-default.js'
const localeCompare = (a, b) => a.x.localeCompare(b.x);
test('implicit connect', async () => {
const db = new Database({ path: ':memory:', url: process.env.VITE_TURSO_DB_URL });
const defer = db.prepare("SELECT * FROM not_found");
await expect(async () => await defer.all()).rejects.toThrowError(/no such table: not_found/);
expect(() => db.prepare("SELECT * FROM not_found")).toThrowError(/no such table: not_found/);
expect(await db.prepare("SELECT 1 as x").all()).toEqual([{ x: 1 }]);
})
test('select-after-push', async () => {
{
const db = await connect({ path: ':memory:', url: process.env.VITE_TURSO_DB_URL });