diff --git a/scripts/studio-runtime-smoke.mjs b/scripts/studio-runtime-smoke.mjs
index bfe0640e00..eb1c1a4019 100644
--- a/scripts/studio-runtime-smoke.mjs
+++ b/scripts/studio-runtime-smoke.mjs
@@ -10,6 +10,8 @@ export const SMOKE_COMPOSITION_HTML =
'
';
+const SMOKE_THUMBNAIL_SVG =
+ '';
function json(body, status = 200) {
return { status, contentType: "application/json", body: JSON.stringify(body) };
@@ -75,6 +77,11 @@ function projectPreviewResponse(pathname) {
: text(SMOKE_COMPOSITION_HTML, "text/html");
}
+function projectThumbnailResponse(pathname) {
+ if (!pathname.startsWith(`${PROJECT_PATH}/thumbnail/`)) return undefined;
+ return text(SMOKE_THUMBNAIL_SVG, "image/svg+xml");
+}
+
function gsapAnimationsResponse(pathname) {
if (!pathname.startsWith(`${PROJECT_PATH}/gsap-animations/`)) return undefined;
return json({ animations: [], timelineVar: "tl", preamble: "", postamble: "" });
@@ -85,6 +92,7 @@ function getStudioSmokeResponse(pathname) {
GET_RESPONSES.get(pathname) ??
projectFileResponse(pathname) ??
projectPreviewResponse(pathname) ??
+ projectThumbnailResponse(pathname) ??
gsapAnimationsResponse(pathname)
);
}
diff --git a/scripts/studio-runtime-smoke.test.mjs b/scripts/studio-runtime-smoke.test.mjs
index a686b48e93..adf1991db6 100644
--- a/scripts/studio-runtime-smoke.test.mjs
+++ b/scripts/studio-runtime-smoke.test.mjs
@@ -44,6 +44,15 @@ describe("Studio runtime smoke fixtures", () => {
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 && response !== null);
+ 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);