feat: ship self-hosted KOC LOOP workflows
This commit is contained in:
31
tests/result-screenshots.test.mjs
Normal file
31
tests/result-screenshots.test.mjs
Normal file
@@ -0,0 +1,31 @@
|
||||
import assert from "node:assert/strict";
|
||||
import test from "node:test";
|
||||
import {
|
||||
MAX_RESULT_SCREENSHOTS,
|
||||
parseResultScreenshotKeys,
|
||||
serializeResultScreenshotKeys,
|
||||
} from "../lib/result-screenshots.ts";
|
||||
|
||||
test("keeps legacy task result screenshots readable", () => {
|
||||
assert.deepEqual(
|
||||
parseResultScreenshotKeys("task-results/dist-1/shot-1.png"),
|
||||
["task-results/dist-1/shot-1.png"],
|
||||
);
|
||||
});
|
||||
|
||||
test("serializes multiple task screenshots safely and caps their count", () => {
|
||||
const keys = Array.from(
|
||||
{ length: MAX_RESULT_SCREENSHOTS + 3 },
|
||||
(_, index) => `task-results/dist-1/shot-${index + 1}.png`,
|
||||
);
|
||||
const serialized = serializeResultScreenshotKeys([
|
||||
...keys,
|
||||
"content-assets/not-allowed.png",
|
||||
]);
|
||||
assert.equal(parseResultScreenshotKeys(serialized).length, MAX_RESULT_SCREENSHOTS);
|
||||
assert.ok(
|
||||
parseResultScreenshotKeys(serialized).every((key) =>
|
||||
key.startsWith("task-results/"),
|
||||
),
|
||||
);
|
||||
});
|
||||
Reference in New Issue
Block a user