- Remove the preset document suite (letters, emails, invoices, quotes, PDF generation, line items) with its routes, API handlers and tables - Rebrand to Cobble: site data, Lato, handoff design tokens (light and dark) in main.css, brand assets in public/brand, ember stone logo and regenerated favicons - Add bots, bot_messages, bot_tasks and bot_task_steps tables, regenerate DB types (BUN_SQLITE_COBBLE_*) and add a sample crew seed (seed:bots) - Add the chat shell at /admin/bots: rail with pinned coordinator and user popover, bottom-anchored conversation with composer, working-on panel, and a send-message API scoped to the session user - Add BotStone and Wordmark components, crew status and relative time utils with tests, and update AGENTS.md Co-Authored-By: Claude Opus 5.5 <[email protected]>
64 lines
1.8 KiB
TypeScript
64 lines
1.8 KiB
TypeScript
import { describe, expect, test } from "bun:test";
|
|
import { crewStatusLine, crewStatusSentence } from "./crew-status";
|
|
|
|
const crew = [
|
|
{ kind: "coordinator", face: "working" },
|
|
{ kind: "worker", face: "needs-you" },
|
|
{ kind: "worker", face: "working" },
|
|
{ kind: "worker", face: "working" },
|
|
{ kind: "worker", face: "working" },
|
|
{ kind: "worker", face: "asleep" },
|
|
];
|
|
|
|
describe("crewStatusLine", () => {
|
|
test("counts workers only", () => {
|
|
expect(crewStatusLine({ bots: crew })).toBe("3 working · 1 needs you");
|
|
});
|
|
|
|
test("pluralises need", () => {
|
|
expect(
|
|
crewStatusLine({
|
|
bots: [
|
|
{ kind: "worker", face: "needs-you" },
|
|
{ kind: "worker", face: "needs-you" },
|
|
],
|
|
}),
|
|
).toBe("2 need you");
|
|
});
|
|
|
|
test("quiet crew", () => {
|
|
expect(crewStatusLine({ bots: [{ kind: "worker", face: "done" }] })).toBe(
|
|
"All quiet",
|
|
);
|
|
});
|
|
});
|
|
|
|
describe("crewStatusSentence", () => {
|
|
test("the signature sentence", () => {
|
|
expect(crewStatusSentence({ bots: crew })).toBe(
|
|
"Three bots are working. One needs you.",
|
|
);
|
|
});
|
|
|
|
test("single working bot", () => {
|
|
expect(
|
|
crewStatusSentence({ bots: [{ kind: "worker", face: "working" }] }),
|
|
).toBe("One bot is working.");
|
|
});
|
|
|
|
test("needs you without working bots names the bots", () => {
|
|
expect(
|
|
crewStatusSentence({
|
|
bots: [
|
|
{ kind: "worker", face: "needs-you" },
|
|
{ kind: "worker", face: "needs-you" },
|
|
],
|
|
}),
|
|
).toBe("Two bots need you.");
|
|
});
|
|
|
|
test("nothing to report", () => {
|
|
expect(crewStatusSentence({ bots: [] })).toBe("Nothing needs you.");
|
|
});
|
|
});
|