Spaces:
Paused
Paused
Download src/async/keepalive.test.ts from bolikoto/zcode-daili: direct link, hf CLI and curl.
- Browser
- Download file 638 Bytes
-
https://huggingface.co/spaces/bolikoto/zcode-daili/resolve/main/src/async/keepalive.test.ts
- Command line
-
hf download hf://spaces/bolikoto/zcode-daili/src/async/keepalive.test.ts
-
curl -L -o keepalive.test.ts https://huggingface.co/spaces/bolikoto/zcode-daili/resolve/main/src/async/keepalive.test.ts
638 Bytes
| import { describe, it, expect } from "bun:test"; | |
| import { keepaliveFrame } from "./keepalive.js"; | |
| describe("keepaliveFrame", () => { | |
| it("produces a single frame with default text", () => { | |
| const frame = keepaliveFrame(); | |
| expect(new TextDecoder().decode(frame)).toBe(": keepalive\n\n"); | |
| }); | |
| it("produces a frame with custom text", () => { | |
| const frame = keepaliveFrame("hello"); | |
| expect(new TextDecoder().decode(frame)).toBe(": hello\n\n"); | |
| }); | |
| it("strips newlines from custom text", () => { | |
| const frame = keepaliveFrame("a\nb\rc"); | |
| expect(new TextDecoder().decode(frame)).toBe(": a b c\n\n"); | |
| }); | |
| }); | |