ci: isolate test setup and fix Windows PDF font paths

This commit is contained in:
amosblomqvist
2026-10-11 10:41:30 +03:00
parent e266c3c028
commit 0540bf697c
9 changed files with 32 additions and 45 deletions
+2 -1
View File
@@ -1598,7 +1598,8 @@ describe("duplicate provider tool-call ids (the Lacan fix)", () => {
() => fauxAssistantMessage([fauxText("Right — and that is where Lacan begins.")]),
]);
const chat = chatStore.createChat("Lacan: duplicate call_0 turns");
const chat = createConfiguredChat("Lacan: duplicate call_0 turns");
createdChats.push(chat.id);
// Turn 1: the ask question.
await drainTurn(post(chat.id, { type: "text", text: "teach me Lacan" }), agentFactory(engine));
let saved = chatStore.getChat(chat.id)!;
+4 -3
View File
@@ -4,6 +4,7 @@ import {
actionForBinding,
bindingForAction,
formatBinding,
IS_MAC,
kbdEventForAction,
KEYBOARD_ACTIONS,
} from "../src/core/keyboard.ts";
@@ -40,7 +41,7 @@ describe("the ⌘B chain — keypress → binding → action → event", () => {
it("mod+b is the toggle-sidebar action", () => {
assert.equal(actionForBinding("mod+b"), "toggle-sidebar");
assert.equal(bindingForAction("toggle-sidebar"), "mod+b");
assert.equal(formatBinding("mod+b"), "⌘B");
assert.equal(formatBinding("mod+b"), IS_MAC ? "⌘B" : "Ctrl+B");
});
it("the event the chain ends in is the one the sidebar answers on", () => {
@@ -51,9 +52,9 @@ describe("the ⌘B chain — keypress → binding → action → event", () => {
});
describe("the thinking pill suffix — ⇧⇥ via the registry", () => {
it("shift+tab formats as ⇧⇥ and maps to cycle-thinking", () => {
it("shift+tab uses the platform's modifier label and maps to cycle-thinking", () => {
assert.equal(actionForBinding("shift+tab"), "cycle-thinking");
assert.equal(formatBinding("shift+tab"), "⇧⇥");
assert.equal(formatBinding("shift+tab"), IS_MAC ? "⇧⇥" : "Shift+⇥");
});
});
+8
View File
@@ -7,9 +7,11 @@
* this process).
*/
import assert from "node:assert/strict";
import * as fs from "node:fs";
import * as path from "node:path";
import { describe, it } from "node:test";
import { realHeadless } from "../src/agent/subagents/headless.ts";
import { standardFontsDir } from "../src/agent/subagents/pdf-ops.ts";
const FIXTURE = path.join(import.meta.dirname, "fixtures", "sample-3page.pdf");
@@ -30,6 +32,12 @@ function pngFacts(buf: Buffer): { w: number; h: number; idats: number } {
}
describe("native pdf_render (pdfjs paints, @napi-rs/canvas hosts)", () => {
it("the shared font directory ends in pdfjs's required slash on every OS", () => {
const fonts = standardFontsDir();
assert.ok(fonts.endsWith("/"), "pdfjs rejects a trailing Windows backslash");
assert.ok(fs.statSync(fonts).isDirectory(), "the filesystem accepts the shared font path");
});
it("renders fixture pages as canonical single-IDAT PNGs", async () => {
const pages = await realHeadless.renderPdfPages(FIXTURE, [1, 3], { dpi: 150 });
assert.equal(pages.length, 2, "requested pages 1 and 3");
+7 -7
View File
@@ -3,10 +3,9 @@
* icon/pill controls ride the styled Radix tooltip via Hint, the shortcut
* appended as an em-dash suffix off the LIVE registry (a rebind changes
* the suffix); truncation-reveals keep native title=; the copy carries no
* internal vocabulary. Node has no navigator → IS_MAC is false → the mod
* glyph renders "Ctrl+" here; the composition logic is the pin, not the
* platform glyph. (Node 26 ships navigator.platform — on this Mac the real
* ⌘/⇧ glyphs render, so they're pinned as-is.)
* internal vocabulary. Node 26 exposes the host platform through navigator,
* so expectations cover Mac glyphs AND Ctrl+/Shift+ elsewhere. Composition
* is the pin; running on a Mac must not be a test prerequisite.
*/
import React from "react";
@@ -19,12 +18,13 @@ import { renderToStaticMarkup } from "react-dom/server";
import { Hint, hintText } from "../components/ui/hint.tsx";
import { TOOLTIP_DELAY_MS } from "../components/ui/tooltip.tsx";
import { AUTO_UPDATE_HINT } from "../components/settings/settings-dialog.tsx";
import { IS_MAC } from "../src/core/keyboard.ts";
describe("hintText — the parenthesized composition", () => {
it("a registry action appends the LIVE binding (override-aware source)", () => {
assert.equal(hintText("Dictate", "toggle-dictation"), "Dictate (⌘D)");
assert.equal(hintText("Settings", "open-settings"), "Settings (⌘,)");
assert.equal(hintText("Search sessions", "sessions-search"), "Search sessions (⌘⇧F)");
assert.equal(hintText("Dictate", "toggle-dictation"), IS_MAC ? "Dictate (⌘D)" : "Dictate (Ctrl+D)");
assert.equal(hintText("Settings", "open-settings"), IS_MAC ? "Settings (⌘,)" : "Settings (Ctrl+,)");
assert.equal(hintText("Search sessions", "sessions-search"), IS_MAC ? "Search sessions (⌘⇧F)" : "Search sessions (Ctrl+Shift+F)");
});
it("surface-owned keys ride the binding prop (no registry entry)", () => {