Skip to content

Commit ea59251

Browse files
committed
fix(test): add missing httpapi scenarios for memory routes and widen prompt test timeouts
- PR #211 merged new memory routes (/memory/global, /memory/project/entries, /memory/entry, /memory/promote) without scenarios in test:httpapi, causing exerciser failure. Added all 4 scenarios. - Widen tight 10s subprocess timeout to 30s in two prompt shell-loop tests observed timing out at ~10,020ms on Windows CI under heavy load (#193).
1 parent 4a1a8f2 commit ea59251

2 files changed

Lines changed: 37 additions & 2 deletions

File tree

‎packages/opencode/test/server/httpapi-exercise/index.ts‎

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2055,6 +2055,41 @@ const scenarios: Scenario[] = [
20552055
.json(200, (body) => {
20562056
check(body === true, "memory forgetProject should return true")
20572057
}),
2058+
http.protected
2059+
.get("/memory/project/entries", "memory.getProjectEntries")
2060+
.at((ctx) => ({ path: `/memory/project/entries?directory=${encodeURIComponent(ctx.directory ?? "")}`, headers: ctx.headers() }))
2061+
.json(200, (body) => {
2062+
object(body)
2063+
check(typeof body.content === "string", "memory getProjectEntries should return content string")
2064+
}),
2065+
http.protected.get("/memory/global", "memory.getGlobalEntries").json(200, (body) => {
2066+
object(body)
2067+
check(typeof body.content === "string", "memory getGlobalEntries should return content string")
2068+
}),
2069+
http.protected
2070+
.post("/memory/entry", "memory.addEntry")
2071+
.mutating()
2072+
.at((ctx) => ({
2073+
path: "/memory/entry",
2074+
headers: ctx.headers(),
2075+
body: { note: "test note from httpapi exercise", directory: ctx.directory },
2076+
}))
2077+
.json(200, (body) => {
2078+
object(body)
2079+
check(typeof body.path === "string", "memory addEntry should return file path")
2080+
}),
2081+
http.protected
2082+
.post("/memory/promote", "memory.promote")
2083+
.mutating()
2084+
.at((ctx) => ({
2085+
path: "/memory/promote",
2086+
headers: ctx.headers(),
2087+
body: { summary: "test summary promoted from httpapi exercise" },
2088+
}))
2089+
.json(200, (body) => {
2090+
object(body)
2091+
check(typeof body.path === "string", "memory promote should return file path")
2092+
}),
20582093

20592094
// --- Config ---
20602095
http.protected.get("/config/globalPath", "config.globalPath").json(200, (body) => {

‎packages/opencode/test/session/prompt.test.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1796,7 +1796,7 @@ it.instance(
17961796
expect(yield* llm.calls).toBe(1)
17971797
}),
17981798
{ git: true },
1799-
10_000,
1799+
30_000,
18001800
)
18011801

18021802
it.instance(
@@ -1835,7 +1835,7 @@ it.instance(
18351835
expect(yield* llm.calls).toBe(1)
18361836
}),
18371837
{ git: true },
1838-
10_000,
1838+
30_000,
18391839
)
18401840

18411841
unix(

0 commit comments

Comments
 (0)