Files
fusion/plugins/fusion-plugin-even-realities-glasses/src/__tests__/notification-card.test.ts
Fusion 089c139bad feat(FN-3743): add polling task notifications for even realities plugin
Commits merged:
- feat(FN-3743): add polling task notifications for even realities plugin

Files changed:
.../fusion-plugin-even-realities-glasses/README.md |  27 +++
 .../package.json                                   |   2 +
 .../src/__tests__/cards.test.ts                    |  82 +++------
 .../src/__tests__/diff.test.ts                     |  76 ++++++++
 .../src/__tests__/notification-card.test.ts        |  40 +++++
 .../src/__tests__/notification-routes.test.ts      |  78 ++++++++
 .../src/__tests__/notification-store.test.ts       |  71 ++++++++
 .../src/__tests__/notifier.test.ts                 | 138 +++++++++-----
 .../src/__tests__/transport.test.ts                |   4 +-
 .../src/agent-actions.ts                           |   4 +-
 .../src/cards.ts                                   | 127 ++++++++++---
 .../src/index.ts                                   |  22 ++-
 .../src/notifications/diff.ts                      |  77 ++++++++
 .../src/notifications/store.ts                     |  46 +++++
 .../src/notifications/types.ts                     |  19 ++
 .../src/notifier.ts                                | 199 +++++++++++++--------
 .../src/routes/notification-routes.ts              | 103 +++++++++++
 pnpm-lock.yaml                                     |  31 +++-
 18 files changed, 929 insertions(+), 217 deletions(-)

Fusion-Task-Id: FN-3743
2026-05-08 16:35:22 -07:00

41 lines
1.3 KiB
TypeScript

import { describe, expect, it } from "vitest";
import { notificationCard } from "../cards.js";
const baseTask = {
id: "FN-1",
description: "Desc",
title: "Ship a very long feature title for notification card behavior",
column: "in-review",
updatedAt: "2026-05-08T10:00:00.000Z",
dependencies: [],
steps: [],
currentStep: 1,
log: [],
} as const;
describe("notificationCard", () => {
it.each([
["entered-column", "In review ·"],
["new-task", "New task ·"],
["left-column", "Moved out ·"],
["completed", "Done ·"],
] as const)("prefixes %s", (reason, prefix) => {
const card = notificationCard(baseTask as never, reason, { now: () => new Date("2026-05-08T10:01:00.000Z") });
expect(card.title.startsWith(prefix)).toBe(true);
expect(card.badge).toBe("in-review");
});
it("truncates title boundary", () => {
const card = notificationCard(baseTask as never, "new-task", { maxCharsPerLine: 16 });
expect(card.title).toContain("…");
});
it("is deterministic with fixed now", () => {
const now = () => new Date("2026-05-08T10:05:00.000Z");
const a = notificationCard(baseTask as never, "completed", { now });
const b = notificationCard(baseTask as never, "completed", { now });
expect(a).toEqual(b);
expect(a.lines[1]).toBe("updated 5m ago");
});
});