feat(backend): ThtRunner wrapper for tht --json (sessions, sql preview/export)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
import { test, expect } from "vitest";
|
||||
import { ThtRunner } from "../src/tht/tht-runner.js";
|
||||
|
||||
test("sessionNew parses id from JSON", async () => {
|
||||
const r = new ThtRunner({ thtBin: "tht", harnessDir: "/h", configPath: "config/tht.yaml" });
|
||||
r.run = async () => ({ code: 0, stdout: '{"id":"2026-06-27-100000-x"}', stderr: "" });
|
||||
expect(await r.sessionNew({ question: "q" })).toEqual({ id: "2026-06-27-100000-x" });
|
||||
});
|
||||
|
||||
test("run with exit != 0 propagates error with stderr", async () => {
|
||||
const r = new ThtRunner({ thtBin: "tht", harnessDir: "/h", configPath: "config/tht.yaml" });
|
||||
r.run = async () => ({ code: 1, stdout: "", stderr: "ERRORE: boom" });
|
||||
await expect(r.sessionList()).rejects.toThrow(/boom/);
|
||||
});
|
||||
Reference in New Issue
Block a user