Files
pi-perplexity/test/render.test.ts
T
Ivan Pereira bbb5623f25 refactor(runtime): replace Bun dependency with Node fetch
Run Perplexity search and auth requests through pi's Node runtime instead of
shelling out to Bun. Move development and CI commands to npm, add a Node test
build path, and keep OTP auth fail-fast when Set-Cookie headers are not
available.
2026-06-23 15:51:16 +01:00

48 lines
1.3 KiB
TypeScript

import { describe, expect, test } from "./test-helpers.js";
import { renderPerplexityCall } from "../src/render/call.js";
import { renderPerplexityResult } from "../src/render/result.js";
const theme = {
fg: (_color: string, text: string) => text,
bold: (text: string) => text,
} as any;
describe("renderPerplexityCall", () => {
test("shows the selected model in the tool call row", () => {
const rendered = renderPerplexityCall(
{
query: "latest Node release notes",
model: "claude46sonnetthinking",
recency: "week",
limit: 5,
},
theme,
).render(200).join("\n");
expect(rendered).toContain("claude46sonnetthinking");
expect(rendered).toContain("week");
expect(rendered).toContain("limit 5");
});
});
describe("renderPerplexityResult", () => {
test("shows the model in the collapsed success row", () => {
const rendered = renderPerplexityResult(
{
content: [{ type: "text", text: "Result summary" }],
details: {
model: "gpt54",
sourceCount: 3,
queryMs: 800,
},
} as any,
{ expanded: false, isPartial: false } as any,
theme,
).render(200).join("\n");
expect(rendered).toContain("gpt54");
expect(rendered).toContain("3 sources");
});
});