opencode/packages/schema/test/v1-isolation.test.ts
Aiden Cline 9e0d3976e1
chore: merge dev into v2 (#35591)
Co-authored-by: Frank <frank@anoma.ly>
Co-authored-by: Aarav Sareen <96787824+arvsrn@users.noreply.github.com>
Co-authored-by: Brendan Allan <git@brendonovich.dev>
Co-authored-by: opencode-agent[bot] <opencode-agent[bot]@users.noreply.github.com>
Co-authored-by: Jack <jack@anoma.ly>
Co-authored-by: Brendan Allan <14191578+Brendonovich@users.noreply.github.com>
Co-authored-by: Shoubhit Dash <shoubhit2005@gmail.com>
Co-authored-by: opencode-agent[bot] <219766164+opencode-agent[bot]@users.noreply.github.com>
Co-authored-by: James Long <longster@gmail.com>
Co-authored-by: Dustin Deus <deusdustin@gmail.com>
Co-authored-by: starptech <starptech@starptechs-MBP.fritz.box>
Co-authored-by: Luke Parker <10430890+Hona@users.noreply.github.com>
Co-authored-by: 𝓛𝓲𝓽𝓽𝓵𝓮 𝓕𝓻𝓪𝓷𝓴 <little-frank@opencord.local>
Co-authored-by: Dax <mail@thdxr.com>
Co-authored-by: usrnk1 <7547651+usrnk1@users.noreply.github.com>
Co-authored-by: Jay <53023+jayair@users.noreply.github.com>
Co-authored-by: runvip <164729189+runvip@users.noreply.github.com>
Co-authored-by: opencode <opencode@sst.dev>
Co-authored-by: Julian Coy <julian@ex-machina.co>
Co-authored-by: Vladimir Glafirov <vglafirov@gitlab.com>
Co-authored-by: Adam <2363879+adamdotdevin@users.noreply.github.com>
Co-authored-by: Kit Langton <kit.langton@gmail.com>
Co-authored-by: Simon Klee <hello@simonklee.dk>
Co-authored-by: Jay <air@live.ca>
Co-authored-by: David Hill <1879069+iamdavidhill@users.noreply.github.com>
2026-07-06 16:05:29 -05:00

28 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([])
})