import { createRequire } from "node:module";

import { describe, expect, it } from "vitest";

const requireFromApi = createRequire(new URL("../../apps/api/package.json", import.meta.url));
const Database = requireFromApi("better-sqlite3");

describe("better-sqlite3 native module", () => {
  it("executes an in-memory query without creating business data", () => {
    const database = new Database(":memory:");
    const row = database.prepare("select 1 as value").get();
    database.close();
    expect(row.value).toBe(1);
  });
});
