GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — opencode/packages/opencode/test/server/session-select.test.ts at dev · gregoryg/opencode Expand file tree/ Copy pathsession-select.test.tsMore file actions 78 lines (67 loc) · 2.23 KB / Copy pathsession-select.test.tsFile metadata and controls78 lines (67 loc) · 2.23 KB 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 import { describe, expect, test } from "bun:test" import path from "path" import { Session } from "../../src/session" import { Log } from "../../src/util/log" import { Instance } from "../../src/project/instance" import { Server } from "../../src/server/server" const projectRoot = path.join(__dirname, "../..") Log.init({ print: false }) describe("tui.selectSession endpoint", () => { test("should return 200 when called with valid session", async () => { await Instance.provide({ directory: projectRoot, fn: async () => { // #given const session = await Session.create({}) // #when const app = Server.Default() const response = await app.request("/tui/select-session", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ sessionID: session.id }), }) // #then expect(response.status).toBe(200) const body = await response.json() expect(body).toBe(true) await Session.remove(session.id) }, }) }) test("should return 404 when session does not exist", async () => { await Instance.provide({ directory: projectRoot, fn: async () => { // #given const nonExistentSessionID = "ses_nonexistent123" // #when const app = Server.Default() const response = await app.request("/tui/select-session", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ sessionID: nonExistentSessionID }), }) // #then expect(response.status).toBe(404) }, }) }) test("should return 400 when session ID format is invalid", async () => { await Instance.provide({ directory: projectRoot, fn: async () => { // #given const invalidSessionID = "invalid_session_id" // #when const app = Server.Default() const response = await app.request("/tui/select-session", { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify({ sessionID: invalidSessionID }), }) // #then expect(response.status).toBe(400) }, }) }) }) |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |