fixing tests, move node tests to vitest

This commit is contained in:
dswbx
2025-06-13 14:38:30 +02:00
parent bbb7bfb7a1
commit f8d2a9090e
27 changed files with 341 additions and 174 deletions

View File

@@ -1,17 +1,11 @@
/// <reference types="bun-types" />
import path from "node:path";
import {
type RuntimeBkndConfig,
createRuntimeApp,
type RuntimeOptions,
Connection,
} from "bknd/adapter";
import { type RuntimeBkndConfig, createRuntimeApp, type RuntimeOptions } from "bknd/adapter";
import { registerLocalMediaAdapter } from ".";
import { config } from "bknd/core";
import type { ServeOptions } from "bun";
import { serveStatic } from "hono/bun";
import { sqlite } from "bknd/adapter/sqlite";
import type { App } from "App";
type BunEnv = Bun.Env;
@@ -25,17 +19,9 @@ export async function createApp<Env = BunEnv>(
const root = path.resolve(distPath ?? "./node_modules/bknd/dist", "static");
registerLocalMediaAdapter();
let connection: Connection | undefined;
if (Connection.isConnection(config.connection)) {
connection = config.connection;
} else {
connection = sqlite(config.connection ?? { url: ":memory:" });
}
return await createRuntimeApp(
{
...config,
connection,
serveStatic: serveStatic({ root }),
},
args ?? (process.env as Env),