Files
opencode/packages/schema/test/v1-isolation.test.ts
+16 9e0d3976e1 chore: merge dev into v2 (#35591)
Co-authored-by: Frank <[email protected]>
Co-authored-by: Aarav Sareen <[email protected]>
Co-authored-by: Brendan Allan <[email protected]>
Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com>
Co-authored-by: Jack <[email protected]>
Co-authored-by: Brendan Allan <[email protected]>
Co-authored-by: Shoubhit Dash <[email protected]>
Co-authored-by: opencode-agent[bot] <219766164+opencode-agent[bot]@users.noreply.github.com>
Co-authored-by: James Long <[email protected]>
Co-authored-by: Dustin Deus <[email protected]>
Co-authored-by: starptech <[email protected]>
Co-authored-by: Luke Parker <[email protected]>
Co-authored-by: 𝓛𝓲𝓽𝓽𝓵𝓮 𝓕𝓻𝓪𝓷𝓴 <[email protected]>
Co-authored-by: Dax <[email protected]>
Co-authored-by: usrnk1 <[email protected]>
Co-authored-by: Jay <[email protected]>
Co-authored-by: runvip <[email protected]>
Co-authored-by: opencode <[email protected]>
Co-authored-by: Julian Coy <[email protected]>
Co-authored-by: Vladimir Glafirov <[email protected]>
Co-authored-by: Adam <[email protected]>
Co-authored-by: Kit Langton <[email protected]>
Co-authored-by: Simon Klee <[email protected]>
Co-authored-by: Jay <[email protected]>
Co-authored-by: David Hill <[email protected]>
2026-07-06 16:05:29 -05:00

29 lines
1.4 KiB
TypeScript

import { expect, test } from "bun:test"
import { LegacyEvent } from "../src/legacy-event.js"
import { PermissionV1 } from "../src/permission-v1.js"
import { QuestionV1 } from "../src/question-v1.js"
import { SessionV1 } from "../src/session-v1.js"
import { LegacyEvent as IsolatedLegacyEvent } from "../src/v1/legacy-event.js"
import { PermissionV1 as IsolatedPermissionV1 } from "../src/v1/permission.js"
import { QuestionV1 as IsolatedQuestionV1 } from "../src/v1/question.js"
import { SessionV1 as IsolatedSessionV1 } from "../src/v1/session.js"
test("compatibility entrypoints preserve isolated V1 schema identity", () => {
expect(LegacyEvent).toBe(IsolatedLegacyEvent)
expect(PermissionV1).toBe(IsolatedPermissionV1)
expect(QuestionV1).toBe(IsolatedQuestionV1)
expect(SessionV1).toBe(IsolatedSessionV1)
})
test("current source does not import the V1 subtree directly", async () => {
const allowed = new Set(["filesystem-v1.ts", "legacy-event.ts", "permission-v1.ts", "question-v1.ts", "session-v1.ts"])
const files = [...new Bun.Glob("*.ts").scanSync(new URL("../src", import.meta.url).pathname)].filter(
(file) => !allowed.has(file),
)
const directImports = await Promise.all(
files.map(async (file) => ({ file, source: await Bun.file(new URL(`../src/${file}`, import.meta.url)).text() })),
).then((values) => values.filter((value) => value.source.includes('from "./v1/')))
expect(directImports).toEqual([])
})