@devries-cameron20 / t3code Mirror · read-only / commits / e63d80a065
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 22:15 UTC

test(web): check custom worksheet targets at the preparation layer (#34586)

Julius Marminge committed Nov 11, 2026 at 14:11 UTC e63d80a06526ad624c92cb784152d034ed5ed6de
1 file changed +9 -16
apps/web/src/components/files/AttachmentFilePreview.browser.test.tsx
+9 -16
@@ -1265,24 +1265,17 @@ it.each([
1265 target.startsWith("/") ? target.slice(1) : `xl/${target}`,
1266 `<worksheet><sheetData><row r="${row}"><c r="A${row}" t="inlineStr"><is><t>worksheet value</t></is></c></row></sheetData></worksheet>`,
1267 );
1268 - const file = await zip.generateAsync({ type: "blob", compression: "DEFLATE" });
1269 - const src = URL.createObjectURL(file);
1270 - try {
1271 - await using screen = await render(
1272 - <div style={{ display: "flex", height: 400, width: 600 }}>
1273 - <OfficeFilePreview name="custom.xlsx" src={src} kind="xlsx" sizeBytes={file.size} />
1274 - </div>,
1268 + const bytes = await zip.generateAsync({ type: "arraybuffer", compression: "DEFLATE" });
1269 + const { prepareOffice } = await import("./officeArchive");
1270 + if (row > 250000) {
1271 + await expect(prepareOffice(bytes, "xlsx")).rejects.toThrow(
1272 + "This workbook exceeds the preview limit",
1273 );
1276 - await vi.waitFor(
1277 - () =>
1278 - expect(screen.container.textContent).toContain(
1279 - row > 250000 ? "This workbook exceeds the preview limit" : "worksheet value",
1280 - ),
1281 - { timeout: 10_000 },
1282 - );
1283 - } finally {
1284 - URL.revokeObjectURL(src);
1274 + return;
1275 }
1276 + const prepared = await prepareOffice(bytes, "xlsx");
1277 + const bounded = await JSZip.loadAsync(prepared.bytes);
1278 + expect(await bounded.file(`xl/${target}`)!.async("string")).toContain("worksheet value");
1279 },
1280 );
1281