mirror of
https://github.com/shishantbiswas/bknd.git
synced 2026-03-16 04:27:21 +00:00
init opfs and sqlocal as another browser adapter
This commit is contained in:
@@ -1,14 +1,15 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { SQLocalConnection, type SQLocalConnectionConfig } from "../src";
|
||||
import { SQLocalConnection } from "../src";
|
||||
import type { ClientConfig } from "sqlocal";
|
||||
import { SQLocalKysely } from "sqlocal/kysely";
|
||||
|
||||
describe(SQLocalConnection, () => {
|
||||
function create(config: SQLocalConnectionConfig = {}) {
|
||||
return new SQLocalConnection(config);
|
||||
function create(config: ClientConfig = { databasePath: ":memory:" }) {
|
||||
return new SQLocalConnection(new SQLocalKysely(config));
|
||||
}
|
||||
|
||||
it("constructs", async () => {
|
||||
const connection = create();
|
||||
expect(() => connection.client).toThrow();
|
||||
await connection.init();
|
||||
expect(connection.client).toBeDefined();
|
||||
expect(await connection.client.sql`SELECT 1`).toEqual([{ "1": 1 }]);
|
||||
|
||||
Reference in New Issue
Block a user