Download packages/session-ui/src/components/markdown-code-state.test.ts from SaylorTwift/opencode: direct link, hf CLI and curl.
- Browser
- Download file 747 Bytes
-
https://huggingface.co/SaylorTwift/opencode/resolve/main/packages/session-ui/src/components/markdown-code-state.test.ts
- Command line
-
hf download hf://SaylorTwift/opencode/packages/session-ui/src/components/markdown-code-state.test.ts
-
curl -L -o markdown-code-state.test.ts https://huggingface.co/SaylorTwift/opencode/resolve/main/packages/session-ui/src/components/markdown-code-state.test.ts
747 Bytes
| import { expect, test } from "bun:test" | |
| import { shouldResetCodeTokens } from "./markdown-code-state" | |
| const previous = { | |
| language: "ts", | |
| generation: 1, | |
| stableCount: 3, | |
| unstable: [], | |
| raw: "```ts\nconst x = 1\n```", | |
| } | |
| test("resets tokens for a non-prefix replacement with the same generation and token count", () => { | |
| expect( | |
| shouldResetCodeTokens(previous, { | |
| language: "ts", | |
| generation: 1, | |
| stableCount: 3, | |
| raw: "```ts\nlet y = 2\n```", | |
| }), | |
| ).toBe(true) | |
| }) | |
| test("retains tokens for an append-only streaming update", () => { | |
| expect( | |
| shouldResetCodeTokens(previous, { | |
| language: "ts", | |
| generation: 1, | |
| stableCount: 4, | |
| raw: `${previous.raw}\nmore`, | |
| }), | |
| ).toBe(false) | |
| }) | |