From e5319846add53292a258e197650d1bf75182cd40 Mon Sep 17 00:00:00 2001 From: Kit Langton Date: Wed, 13 May 2026 11:43:09 -0400 Subject: [PATCH] test(server): migrate pty websocket input test (#27348) --- .../test/server/httpapi-pty-websocket.test.ts | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/packages/opencode/test/server/httpapi-pty-websocket.test.ts b/packages/opencode/test/server/httpapi-pty-websocket.test.ts index 81ee952d96..19d97ef09c 100644 --- a/packages/opencode/test/server/httpapi-pty-websocket.test.ts +++ b/packages/opencode/test/server/httpapi-pty-websocket.test.ts @@ -1,16 +1,19 @@ -import { describe, expect, test } from "bun:test" +import { describe, expect } from "bun:test" import { Effect } from "effect" import { handlePtyInput } from "../../src/pty/input" +import { it } from "../lib/effect" describe("pty HttpApi websocket input", () => { - test("does not forward invalid binary frames to the PTY handler", async () => { - const messages: Array = [] - const handler = { onMessage: (message: string | ArrayBuffer) => messages.push(message) } + it.effect("does not forward invalid binary frames to the PTY handler", () => + Effect.gen(function* () { + const messages: Array = [] + const handler = { onMessage: (message: string | ArrayBuffer) => messages.push(message) } - await Effect.runPromise(handlePtyInput(handler, "ready")) - await Effect.runPromise(handlePtyInput(handler, new Uint8Array([0xff, 0xfe, 0xfd]))) - await Effect.runPromise(handlePtyInput(handler, new TextEncoder().encode("hello"))) + yield* handlePtyInput(handler, "ready") + yield* handlePtyInput(handler, new Uint8Array([0xff, 0xfe, 0xfd])) + yield* handlePtyInput(handler, new TextEncoder().encode("hello")) - expect(messages).toEqual(["ready", "hello"]) - }) + expect(messages).toEqual(["ready", "hello"]) + }), + ) })