Files
oh-my-opencode/src/plugin/ultrawork-db-model-override.bun-sqlite-unavailable.test.ts
T
YeonGyu-Kim aae619c58f fix(ultrawork): align lazy sqlite fallback test
Keep bun:sqlite loading lazy and verify the unavailable-runtime fallback without a test-only importer seam.

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
2026-05-05 19:09:31 +09:00

21 lines
845 B
TypeScript

import { describe, expect, test } from "bun:test"
describe("scheduleDeferredModelOverride bun:sqlite unavailable", () => {
test("#given source code #when inspected #then bun:sqlite is loaded dynamically with an unavailable-runtime fallback", async () => {
//#given
const source = await Bun.file(new URL("./ultrawork-db-model-override.ts", import.meta.url)).text()
//#when
const hasStaticBunSqliteImport = source.includes('from "bun:sqlite"')
|| source.includes("from 'bun:sqlite'")
|| source.includes('import "bun:sqlite"')
|| source.includes("import 'bun:sqlite'")
//#then
expect(hasStaticBunSqliteImport).toBe(false)
expect(source).toContain('await import("bun:sqlite").catch(() => null)')
expect(source).toContain("bun:sqlite unavailable")
expect(source).toContain("return")
})
})