Skip to content

A full-featured CRM built with React, shadcn/ui, and Supabase.

hide error logs in functions tests

ThieryMichel54a1291f36ed
diff --git a/supabase/functions/postmark/forwardedParser.test.ts b/supabase/functions/postmark/forwardedParser.test.ts
index ede584e6..c42296f9 100644
--- a/supabase/functions/postmark/forwardedParser.test.ts
+++ b/supabase/functions/postmark/forwardedParser.test.ts
@@ -1,4 +1,4 @@
-import { describe, it, expect } from "vitest";
+import { describe, it, expect, vi } from "vitest";
import {
stripForwardingHeaderBlock,
stripSubjectForwardingPrefix,
@@ -231,8 +231,10 @@ describe("forwardedParser", () => {
});
it("should return original subject if stripping results in empty string", () => {
+ vi.spyOn(console, "warn").mockImplementation(() => {});
const subject = "Fwd: ";
expect(stripSubjectForwardingPrefix(subject)).toBe(subject);
+ vi.restoreAllMocks();
});
});
@@ -276,6 +278,7 @@ describe("forwardedParser", () => {
});
it("returns original text when stripping results in empty content", () => {
+ vi.spyOn(console, "warn").mockImplementation(() => {});
const text = [
"---------- Forwarded message ----------",
"From: Alice <[email protected]>",
@@ -285,6 +288,7 @@ describe("forwardedParser", () => {
// Both stripping operations would result in empty content, so original text should be returned.
expect(getForwardedMailContent(text)).toBe(text.trim());
+ vi.restoreAllMocks();
});
it("handles text with no forwarding header and no signature", () => {