diff options
| author | Dax Raad <[email protected]> | 2026-04-14 23:10:07 -0400 |
|---|---|---|
| committer | Dax Raad <[email protected]> | 2026-04-14 23:10:25 -0400 |
| commit | 627159acac04409d7697a6739e2c572c2a010943 (patch) | |
| tree | 5f87465ea69f41aff0cd96ae5411fe438da480b3 /packages/app/test | |
| parent | f44aa02e2677b2b89a1a9f517c0ff8990383deaa (diff) | |
| download | opencode-627159acac04409d7697a6739e2c572c2a010943.tar.gz opencode-627159acac04409d7697a6739e2c572c2a010943.zip | |
delete all e2e tests (#22501)
Cherry-picked from ea463e604cdd2a3e83e1c286e39b789455f0d413
Diffstat (limited to 'packages/app/test')
| -rw-r--r-- | packages/app/test/e2e/mock.test.ts | 66 | ||||
| -rw-r--r-- | packages/app/test/e2e/no-real-llm.test.ts | 27 |
2 files changed, 0 insertions, 93 deletions
diff --git a/packages/app/test/e2e/mock.test.ts b/packages/app/test/e2e/mock.test.ts deleted file mode 100644 index 3bd80f34d..000000000 --- a/packages/app/test/e2e/mock.test.ts +++ /dev/null @@ -1,66 +0,0 @@ -import { describe, expect, test } from "bun:test" -import { bodyText, inputMatch, promptMatch } from "../../e2e/prompt/mock" - -function hit(body: Record<string, unknown>) { - return { body } -} - -describe("promptMatch", () => { - test("matches token in serialized body", () => { - const match = promptMatch("hello") - expect(match(hit({ messages: [{ role: "user", content: "say hello" }] }))).toBe(true) - expect(match(hit({ messages: [{ role: "user", content: "say goodbye" }] }))).toBe(false) - }) -}) - -describe("inputMatch", () => { - test("matches exact tool input in chat completions body", () => { - const input = { questions: [{ header: "Need input", question: "Pick one" }] } - const match = inputMatch(input) - - // The seed prompt embeds JSON.stringify(input) in the user message - const prompt = `Use this JSON input: ${JSON.stringify(input)}` - const body = { messages: [{ role: "user", content: prompt }] } - expect(match(hit(body))).toBe(true) - }) - - test("matches exact tool input in responses API body", () => { - const input = { questions: [{ header: "Need input", question: "Pick one" }] } - const match = inputMatch(input) - - const prompt = `Use this JSON input: ${JSON.stringify(input)}` - const body = { model: "test", input: [{ role: "user", content: [{ type: "input_text", text: prompt }] }] } - expect(match(hit(body))).toBe(true) - }) - - test("matches patchText with newlines", () => { - const patchText = "*** Begin Patch\n*** Add File: test.txt\n+line1\n*** End Patch" - const match = inputMatch({ patchText }) - - const prompt = `Use this JSON input: ${JSON.stringify({ patchText })}` - const body = { messages: [{ role: "user", content: prompt }] } - expect(match(hit(body))).toBe(true) - - // Also works in responses API format - const respBody = { model: "test", input: [{ role: "user", content: [{ type: "input_text", text: prompt }] }] } - expect(match(hit(respBody))).toBe(true) - }) - - test("does not match unrelated requests", () => { - const input = { questions: [{ header: "Need input" }] } - const match = inputMatch(input) - - expect(match(hit({ messages: [{ role: "user", content: "hello" }] }))).toBe(false) - expect(match(hit({ model: "test", input: [] }))).toBe(false) - }) - - test("does not match partial input", () => { - const input = { questions: [{ header: "Need input", question: "Pick one" }] } - const match = inputMatch(input) - - // Only header, missing question - const partial = `Use this JSON input: ${JSON.stringify({ questions: [{ header: "Need input" }] })}` - const body = { messages: [{ role: "user", content: partial }] } - expect(match(hit(body))).toBe(false) - }) -}) diff --git a/packages/app/test/e2e/no-real-llm.test.ts b/packages/app/test/e2e/no-real-llm.test.ts deleted file mode 100644 index c801df56f..000000000 --- a/packages/app/test/e2e/no-real-llm.test.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { describe, expect, test } from "bun:test" -import path from "node:path" -import { fileURLToPath } from "node:url" - -const dir = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "../../e2e") - -function hasPrompt(src: string) { - if (!src.includes("withProject(")) return false - if (src.includes("withNoReplyPrompt(")) return false - if (src.includes("session.promptAsync({") && !src.includes("noReply: true")) return true - if (!src.includes("promptSelector")) return false - return src.includes('keyboard.press("Enter")') || src.includes('prompt.press("Enter")') -} - -describe("e2e llm guard", () => { - test("withProject specs do not submit prompt replies", async () => { - const bad: string[] = [] - - for await (const file of new Bun.Glob("**/*.spec.ts").scan({ cwd: dir, absolute: true })) { - const src = await Bun.file(file).text() - if (!hasPrompt(src)) continue - bad.push(path.relative(dir, file)) - } - - expect(bad).toEqual([]) - }) -}) |
