Create polished demo videos without editing skills. Mac/Windows/Linux
test(extensions): cover malformed marketplace details
wiiiii123c6808db6ac4b
diff --git a/electron/extensions/errorUtils.test.ts b/electron/extensions/errorUtils.test.tsindex 7e121411..5b834b3b 100644--- a/electron/extensions/errorUtils.test.ts+++ b/electron/extensions/errorUtils.test.ts@@ -38,6 +38,28 @@ describe("formatMarketplaceHttpError", () => {).toBe("Marketplace request failed (HTTP 409): Extension version already exists");});+ it("prefers a string error when both JSON detail fields are present", () => {+ expect(+ formatMarketplaceHttpError({+ status: 400,+ contentType: "application/json",+ body: JSON.stringify({ error: "Primary detail", message: "Secondary detail" }),+ }),+ ).toBe("Marketplace request failed (HTTP 400): Primary detail");+ });++ it("hides malformed JSON bodies", () => {+ const body = '{"error":"internal route details"';+ const message = formatMarketplaceHttpError({+ status: 400,+ contentType: "application/json",+ body,+ });++ expect(message).toBe("Marketplace request failed (HTTP 400).");+ expect(message).not.toContain(body);+ });+it("bounds long JSON details and marks truncation without splitting Unicode", () => {const detail = `🚀${"x".repeat(200)}`;const message = formatMarketplaceHttpError({