ee9add076a
Build and Push Docker Image / build (push) Successful in 1m17s
the separate Library page was mostly duplicating what the pipeline columns + the item detail page already show. move its two useful bits — the stats row (total / scanned / needs action / no change / approved / done / errors) and the scan control bar — into a compact two-row header above the pipeline columns, drop the library items table entirely, and redirect "/" to "/pipeline". the scan SSE buffering logic moves verbatim into PipelineHeader.tsx so the progress bar and the stats refresh on completion keep working. the dead /api/scan/items endpoint and its parseScanItemsQuery + buildScanItemsWhere helpers (plus their tests) go away with the UI; /api/scan, /api/scan/start, /api/scan/stop, /api/scan/events stay. nav loses "Library" — Pipeline is the only entry point now. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
32 lines
1.5 KiB
TypeScript
32 lines
1.5 KiB
TypeScript
import { describe, expect, test } from "bun:test";
|
|
import { parseScanLimit } from "../scan";
|
|
|
|
describe("parseScanLimit", () => {
|
|
test("accepts positive integers and nullish/empty as no-limit", () => {
|
|
expect(parseScanLimit(5)).toEqual({ ok: true, value: 5 });
|
|
expect(parseScanLimit(1)).toEqual({ ok: true, value: 1 });
|
|
expect(parseScanLimit(10_000)).toEqual({ ok: true, value: 10_000 });
|
|
expect(parseScanLimit(null)).toEqual({ ok: true, value: null });
|
|
expect(parseScanLimit(undefined)).toEqual({ ok: true, value: null });
|
|
expect(parseScanLimit("")).toEqual({ ok: true, value: null });
|
|
});
|
|
|
|
test("coerces numeric strings (env var path) but rejects garbage", () => {
|
|
expect(parseScanLimit("7")).toEqual({ ok: true, value: 7 });
|
|
expect(parseScanLimit("abc")).toEqual({ ok: false });
|
|
expect(parseScanLimit("12abc")).toEqual({ ok: false });
|
|
});
|
|
|
|
test("rejects the footguns that would silently disable the cap", () => {
|
|
// NaN: processed >= NaN never trips → cap never fires.
|
|
expect(parseScanLimit(Number.NaN)).toEqual({ ok: false });
|
|
// Negative: off-by-one bugs in Math.min(limit, total).
|
|
expect(parseScanLimit(-1)).toEqual({ ok: false });
|
|
expect(parseScanLimit(0)).toEqual({ ok: false });
|
|
// Float: Math.min is fine but percentage math breaks on non-integers.
|
|
expect(parseScanLimit(1.5)).toEqual({ ok: false });
|
|
// Infinity is technically a number but has no business as a cap.
|
|
expect(parseScanLimit(Number.POSITIVE_INFINITY)).toEqual({ ok: false });
|
|
});
|
|
});
|