mirror of
https://github.com/aljazceru/turso.git
synced 2025-12-24 03:34:18 +01:00
fix tests
This commit is contained in:
@@ -12,10 +12,11 @@ function cleanup(path) {
|
||||
try { unlinkSync(`${path}-wal-revert`) } catch (e) { }
|
||||
}
|
||||
|
||||
test('explicit connect', async () => {
|
||||
test('implicit connect', async () => {
|
||||
const db = new Database({ path: ':memory:', url: process.env.VITE_TURSO_DB_URL });
|
||||
expect(() => db.prepare("SELECT 1")).toThrowError(/database must be connected/g);
|
||||
await db.connect();
|
||||
const defer = db.prepare("SELECT * FROM t");
|
||||
await expect(async () => await defer.all()).rejects.toThrowError(/no such table: t/);
|
||||
expect(() => db.prepare("SELECT * FROM t")).toThrowError(/no such table: t/);
|
||||
expect(await db.prepare("SELECT 1 as x").all()).toEqual([{ x: 1 }]);
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user