mirror of
https://github.com/storytold/autocraft.git
synced 2026-11-29 17:44:04 +01:00
Kept: test/items-filters.test.ts (the phase and list endpoints never take each other's keys, two tests), test/needs-controls.test.ts (parseScope), test/needs-list-scope.test.ts (cursor isolation), and the item-trace server test. Removed test files: items-rows, needs-detail, needs-evidence, needs-review, needs-rows and needs-timeline. Removed tests: test/items-filters.test.ts: - an empty URL is the approved default: open state, first page, no phase - a phase link that also names classification scopes says they are not applied - an explicit all-state remains visible but unapplied under a phase - values outside their contract stay in the URL and are reported as not applied - the legacy /items/filters alias keeps every key but phase and lands in the one browser - clear phase returns in place to regular filtering and keeps the shared filters - reset clears every filter key this browser owns - page size and offset stay finite and integral before they reach the server - the phone Filters count and summary match the approved hierarchy - the filtered-view bar appears for a search, a facet or a phase, not for the default - default sorts are omitted exactly where the API cannot honour them - the preview key only accepts a repo#number ref - F1: constraints that live outside the toolbar are applied, visible and resettable - F2: flow and run are applied on the list endpoint and not applied under a phase - F3: a comma label list applies only its first value and marks the rest - F3: mixed valid and invalid CSV status/flag entries separate applied from not applied - F3: multiple repositories stay applied and are shown as their values - F5: under a phase the disabled scopes read their defaults, and the link's values are chips - removing one chip drops only its own CSV value - phase compatibility chips remove raw status and flag values without changing their display labels - the primary selects always name the applied value, never 'Any' for an applied scope - F7: discrete Items actions push one history entry; typing and the alias replace test/items-rows.test.ts: - a selection parses open=repo#number and reports what it cannot use - a legacy peek link is the same selection under its old name - toggling the row writes or clears only the selection keys - an unusable selection is described, never turned into a row - last events keep the latest supplied subset and display it oldest first - F4: a canonical open wins by presence, including when it is empty or malformed - F5: an out-of-cohort selection is explicit even when the cohort is empty - F7: a receipt is only usable when it is settled, un-failed and for this row - F7: a list payload renders only for the reader it was fetched for - N2: a disputed, unapplied answer is held ahead of any exec write state - Items reader receipts reject prior project rows while the new project has no receipt test/needs-controls.test.ts: - an unknown repository is a real filter that matches nothing, not an ignored value - values the API will not use are kept apart, never applied - Clear scope drops the four scope keys, the preview and nothing else - queue-tab links carry the compatible scope, drop the preview and set the tab - B1: the effective age is the server's own arithmetic, shared by the request and the controls - B1: only whitelisted kinds are sent; unknown kinds stay in the raw link - B2: every raw scope value has a direct cleanup that keeps the others test/needs-detail.test.ts: - one non-empty decision value requests it; empty, duplicate and malformed values stay honest - the active decision is the requested id only when the current receipt holds it - the bookmark is one latest-scope record with a paired anchor identity and a fallback offset - restoration follows the anchor row; a lost row uses its same-read fallback offset, clamped - capture validity is state (epoch/visibility), never the offset value - the focus clock is independent of the bookmark version - the guard accepts only the owned outer root, the live URI/scope and the current focus version - opaque ids with delimiters survive the round trip unchanged - the live projected scope changes when a filter changes but the primary id stays - a pending focus intent cannot follow the same decision into a different project test/needs-evidence.test.ts: - item evidence: a viewer never sees staff-only summary/why/risks, whatever the payload says test/needs-list-scope.test.ts: - the key keeps the decisions? topic prefix the live invalidation depends on - the scope string is a collision-safe JSON tuple of reader and filter - only pages fetched for the current scope are exposed - only a real, non-empty server cursor becomes a continuation - project changes reject previous pages and cursors even before the URL is synchronized - multi-repo list URLs remain a distinct all-projects request scope test/needs-review.test.ts: - explicit review claims presence then opens the native item decision, without answering - viewers open the native read-only item without a claim - reviewing an answered decision never sends a new presence claim - a refused presence claim does not hide or delay the full answer form - batch and memberless decisions retain the native item or resolver route test/needs-rows.test.ts: - roving selection defaults to the first row and clamps every movement test/needs-timeline.test.ts: - U01 reference.own-issue-pr - U02 reference.invalid-number - U03 reference.invalid-repo - U04 reference.no-member-guess - U12 model.more-than-four - U23 read.error-data - U24 read.blank-error - U25 read.waiting
18 lines
922 B
TypeScript
18 lines
922 B
TypeScript
// The Needs scope reads exactly the URL keys the decisions endpoint reads.
|
|
import assert from "node:assert/strict";
|
|
import { test } from "node:test";
|
|
import { parseScope } from "../web/src/modules/decisions/needs-controls.ts";
|
|
|
|
const KINDS = ["scope", "duplicate", "close", "merge", "hold", "split", "other"];
|
|
|
|
test("the scope parses exactly the keys the server reads", () => {
|
|
const scope = parseScope("?repo=deckcraft&kind=scope,merge&age=3&all=1", KINDS);
|
|
assert.deepEqual(scope.repo, ["deckcraft"]);
|
|
assert.deepEqual(scope.kind, ["scope", "merge"]);
|
|
assert.equal(scope.minAge, 3);
|
|
assert.equal(scope.all, true);
|
|
assert.deepEqual(scope.unusedKinds, []);
|
|
assert.equal(scope.unusedAge, undefined);
|
|
assert.deepEqual(parseScope("", KINDS), { repo: [], kind: [], minAge: undefined, all: false, unusedKinds: [], unusedAge: undefined, cappedAge: undefined, raw: { repo: [], kind: [], age: undefined } });
|
|
});
|