mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-19 19:36:04 +00:00
Advertise the CLI sharing bridge before bootstrapping it so standalone Studio does not request unsupported routes. Preserve origin and session checks. Budget the intended sharing artifact: clean main packs at 8,060,519 bytes versus 8,162,979 with sharing (8,169,168 in CI). Required policy and Unicode tables, bundled sharing code, and Studio controls account for the growth. Set the packed-only budget to 8,577,627, following the 5% headroom convention; retain the unpacked cap and all package checks.
71 lines
2.6 KiB
JavaScript
71 lines
2.6 KiB
JavaScript
import assert from "node:assert/strict";
|
|
import { describe, it } from "node:test";
|
|
import {
|
|
isExpectedStudioSmokeError,
|
|
SMOKE_COMPOSITION_HTML,
|
|
studioSmokeApiResponse,
|
|
} from "./studio-runtime-smoke.mjs";
|
|
|
|
function bodyOf(method, path) {
|
|
const response = studioSmokeApiResponse(method, `http://localhost:5199${path}`);
|
|
assert.ok(response);
|
|
return JSON.parse(response.body);
|
|
}
|
|
|
|
describe("Studio runtime smoke fixtures", () => {
|
|
it("bootstraps the sharing entry point without credentials", () => {
|
|
assert.deepEqual(bodyOf("GET", "/api/share/bootstrap"), { csrf: "s".repeat(43) });
|
|
});
|
|
it("matches the collection and project-detail API schemas", () => {
|
|
assert.deepEqual(bodyOf("GET", "/api/projects"), {
|
|
projects: [{ id: "smoke-test", dir: "/tmp/smoke-test", title: "Smoke test" }],
|
|
});
|
|
assert.deepEqual(bodyOf("GET", "/api/projects/smoke-test"), {
|
|
id: "smoke-test",
|
|
dir: "/tmp/smoke-test",
|
|
title: "Smoke test",
|
|
files: ["index.html"],
|
|
compositions: ["index.html"],
|
|
});
|
|
});
|
|
|
|
it("returns file content rather than the unrelated file-tree shape", () => {
|
|
assert.deepEqual(bodyOf("GET", "/api/projects/smoke-test/files/index.html"), {
|
|
filename: "index.html",
|
|
content: SMOKE_COMPOSITION_HTML,
|
|
});
|
|
});
|
|
|
|
it("returns iterable collections for eager Studio queries", () => {
|
|
assert.deepEqual(bodyOf("GET", "/api/projects/smoke-test/renders"), { renders: [] });
|
|
assert.deepEqual(bodyOf("GET", "/api/projects/smoke-test/gsap-animations/index.html"), {
|
|
animations: [],
|
|
timelineVar: "tl",
|
|
preamble: "",
|
|
postamble: "",
|
|
});
|
|
assert.deepEqual(bodyOf("GET", "/api/projects/smoke-test/lint"), { findings: [] });
|
|
});
|
|
|
|
it("returns an image for composition thumbnail requests", () => {
|
|
const response = studioSmokeApiResponse(
|
|
"GET",
|
|
"http://localhost:5199/api/projects/smoke-test/thumbnail/index.html?t=3",
|
|
);
|
|
assert.ok(response);
|
|
assert.equal(response.contentType, "image/svg+xml");
|
|
});
|
|
|
|
it("marks unknown API requests as fixture failures", () => {
|
|
assert.equal(studioSmokeApiResponse("GET", "http://localhost:5199/api/new-endpoint"), null);
|
|
assert.equal(studioSmokeApiResponse("GET", "http://localhost:5199/src/main.tsx"), undefined);
|
|
});
|
|
|
|
it("does not suppress generic JavaScript or network failures", () => {
|
|
assert.equal(isExpectedStudioSmokeError("Cannot read properties of undefined"), false);
|
|
assert.equal(isExpectedStudioSmokeError("value is not iterable"), false);
|
|
assert.equal(isExpectedStudioSmokeError("Failed to fetch"), false);
|
|
assert.equal(isExpectedStudioSmokeError("GET /favicon.ico 404"), true);
|
|
});
|
|
});
|