/
Alex_Ural
/
opencode
Обзор
Документация
Войти
/
Alex_Ural
/
opencode
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
dev
packages/session-ui/src/components/message-part.test.ts
28 строк
1 KB
Victor Navarro
refactor(ui): isolate session components (#33670)
24 июн 2026, 17:56
Не верифицирован
24 июн 2026, 17:56
04c1730
Код
Авторство
О чём код?
import { describe, expect, test } from "bun:test" import { readPartText } from "./message-part-text" describe("readPartText", () => { test("returns empty string when accum is undefined and part text is undefined", () => { expect(readPartText(undefined, { id: "part_1" })).toBe("") }) test("returns trimmed part text when accum is undefined", () => { expect(readPartText(undefined, { id: "part_1", text: " hello " })).toBe("hello") }) test("prefers accum value over part text when accum has a hit", () => { expect(readPartText({ part_1: " from accum " }, { id: "part_1", text: "from part" })).toBe("from accum") }) test("falls back to part text when accum misses", () => { expect(readPartText({ other_part: "ignored" }, { id: "part_1", text: " from part " })).toBe("from part") }) test("returns empty string for whitespace-only text", () => { expect(readPartText(undefined, { id: "part_1", text: " \n\t " })).toBe("") }) test("trims leading and trailing whitespace", () => { expect(readPartText(undefined, { id: "part_1", text: "\n body \n" })).toBe("body") }) })