From 0ad24ba83f2fe6bf4cf92b9243640a33df095880 Mon Sep 17 00:00:00 2001 From: Michael Wang Date: Tue, 17 Nov 2026 04:35:31 +0000 Subject: [PATCH] test(cli): a received project's preview still converts a photo inside it (#8021) Pins that preview image prep, with outside files refused, still converts an in-project HEIC. It runs on a real folder, so the Windows CI lanes check it under Windows path rules. --- .../server/studioServer.previewAssets.test.ts | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/packages/cli/src/server/studioServer.previewAssets.test.ts b/packages/cli/src/server/studioServer.previewAssets.test.ts index 4c08b2b1d6..40655f2e1e 100644 --- a/packages/cli/src/server/studioServer.previewAssets.test.ts +++ b/packages/cli/src/server/studioServer.previewAssets.test.ts @@ -184,6 +184,29 @@ describe("preview image prep and files outside the project", () => { } }); + it("still converts a photo inside a received project, with outside files refused", async () => { + fs.mkdirSync(path.join(projectDir, ".hyperframes"), { recursive: true }); + fs.writeFileSync( + path.join(projectDir, ".hyperframes", "received-files.json"), + JSON.stringify({ files: ["index.html"] }), + ); + fs.mkdirSync(path.join(projectDir, "photos")); + fs.copyFileSync(heic, path.join(projectDir, "photos", "IMG_0002.HEIC")); + fs.writeFileSync( + path.join(projectDir, "index.html"), + `
+ +
`, + ); + const warn = vi.spyOn(console, "warn").mockImplementation(() => {}); + try { + expect(await previewPhotoSrc()).toMatch(/^\.hyperframes\/prepared-assets\/heif\//); + expect(fs.readdirSync(preparedHeif())).toHaveLength(1); + } finally { + warn.mockRestore(); + } + }); + it("still converts an outside photo for the developer's own project, as its render does", async () => { expect(await previewPhotoSrc()).toMatch(/^\.hyperframes\/prepared-assets\/heif\//); expect(fs.readdirSync(preparedHeif())).toHaveLength(1);