Files
PaperClipAI/scripts/build-preview-migrator.test.mjs
T
DottaandPaperclip 639d8875bb Build staging migrator artifacts and align native sandbox sessions with HOME
Use object-storage artifact URLs and Actions build artifacts without creating releases. Fix both native session entry points, preserve the primary workspace environment, and declare upload headers in OpenAPI. Tests cover sandbox home confinement, session dispatch, and generated headers.

Co-Authored-By: Paperclip <noreply@paperclip.ing>
2026-09-07 12:56:29 -05:00

20 lines
1.1 KiB
JavaScript

import assert from "node:assert/strict";
import test from "node:test";
import { previewIdentity } from "./build-preview-migrator.mjs";
test("preview artifact identity is immutable, namespaced, and ordered by commit time", () => {
const sha = "2f42a4968d5761fd62172e35ecf8188195b8d431";
const identity = previewIdentity(sha, new Date("2026-07-19T09:30:00.000Z"), "https://staging.example/migrators");
assert.equal(identity.version, `2026.719.34201-preview.sha${sha}`);
assert.equal(identity.tag, `preview/${sha}`);
assert.equal(identity.baseUrl, `https://staging.example/migrators/${sha}`);
assert.throws(() => previewIdentity("master", new Date()), /Invalid preview/);
assert.throws(() => previewIdentity(sha, new Date("invalid")), /Invalid preview/);
});
test("staging artifact URLs cannot carry credentials or use plaintext", () => {
for (const url of ["http://staging.example", "https://user:secret@staging.example", "https://staging.example?token=secret"]) {
assert.throws(() => previewIdentity("a".repeat(40), new Date(), url), /Invalid staging/);
}
});