mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-10-28 22:25:24 +00:00
21 lines
705 B
TypeScript
21 lines
705 B
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { parseAsciicast } from "../../src/frontend/asciicast";
|
|
|
|
describe("parseAsciicast", () => {
|
|
it("parses terminal dimensions and timed input/output", () => {
|
|
const recording = parseAsciicast(
|
|
'{"version":2,"width":120,"height":30}\n[0.1,"o","hello"]\n[1.5,"i","ls\\r"]\n[2,"r","100x40"]\n',
|
|
);
|
|
expect(recording.width).toBe(120);
|
|
expect(recording.height).toBe(30);
|
|
expect(recording.duration).toBe(2);
|
|
expect(recording.events).toHaveLength(3);
|
|
});
|
|
|
|
it("rejects unsupported recording versions", () => {
|
|
expect(() => parseAsciicast('{"version":1}\n')).toThrow(
|
|
"Unsupported asciicast version",
|
|
);
|
|
});
|
|
});
|