The quality gates card stacked its number and rows across the full row width -- the rate pinned to the left edge, the counts to the right -- which reads as two places at once. The card now has two internal sections, left to right: the rate, and the per-workflow rows that explain it; the row collapses under 720px. Also swept the restating descriptions: 'Work that passed its quality gates' under Quality gates, 'Archie needs these before it can work on its own' under Finish setting up, 'Next 30 days at the current rate' under Token outlook, 'Last 50, newest first' under Live activity. A title and a sentence that restate each other are noise; the table or chart says the thing. CapturesCard's redaction note is a security fact, not restatement, and stays. The unconfigured versions state is one quiet line, not a card with a title, a description, and a sentence.
38 lines
1.5 KiB
TypeScript
38 lines
1.5 KiB
TypeScript
import assert from "node:assert/strict";
|
|
import test from "node:test";
|
|
|
|
const { tokenizeJson, tokenClass } = await import("../src/lib/json-tokens.ts");
|
|
|
|
test("a valid JSON document tokenizes into typed spans", () => {
|
|
const tokens = tokenizeJson('{"name":"archie","count":3}');
|
|
assert.ok(tokens, "valid JSON must tokenize");
|
|
const kinds = tokens.map((t) => t.kind);
|
|
assert.ok(tokens.some((t) => t.kind === "key" && t.text === '"name"'));
|
|
assert.ok(tokens.some((t) => t.kind === "string" && t.text === '"archie"'));
|
|
assert.ok(tokens.some((t) => t.kind === "number" && t.text === "3" || t.text.endsWith("3")));
|
|
assert.ok(tokens.some((t) => t.kind === "punct" && t.text.includes("{")));
|
|
});
|
|
|
|
test("every character of the source survives, verbatim", () => {
|
|
const source = '{"a":1,"b":[true,null],"c":"x\\u0041"}';
|
|
const tokens = tokenizeJson(source);
|
|
assert.ok(tokens);
|
|
assert.equal(tokens.map((t) => t.text).join(""), source);
|
|
});
|
|
|
|
test("nested structures keep their punctuation", () => {
|
|
const tokens = tokenizeJson('{"k":{"n":[1,2]}}');
|
|
assert.ok(tokens);
|
|
const open = tokens.filter((t) => t.kind === "punct" && t.text.includes("{"));
|
|
assert.equal(open.length >= 1, true);
|
|
});
|
|
|
|
test("a non-JSON payload yields null, and the caller renders it plain", () => {
|
|
assert.equal(tokenizeJson("not json at all"), null);
|
|
assert.equal(tokenizeJson(""), null);
|
|
assert.equal(tokenizeJson("{broken"), null);
|
|
});
|
|
|
|
test("an empty string is not JSON", () => {
|
|
assert.equal(tokenizeJson(""), null);
|
|
}); |