From 91954ed69b623e886482b5145f9909420d4e7949 Mon Sep 17 00:00:00 2001 From: Francis Cao Date: Mon, 3 Aug 2026 15:06:55 -0700 Subject: [PATCH] fix failed attribution tests --- .../attribution/AttributionPage.test.tsx | 100 ++++++++++++------ 1 file changed, 66 insertions(+), 34 deletions(-) diff --git a/src/app/(main)/websites/[websiteId]/(reports)/attribution/AttributionPage.test.tsx b/src/app/(main)/websites/[websiteId]/(reports)/attribution/AttributionPage.test.tsx index f1df189ef..df994a3d3 100644 --- a/src/app/(main)/websites/[websiteId]/(reports)/attribution/AttributionPage.test.tsx +++ b/src/app/(main)/websites/[websiteId]/(reports)/attribution/AttributionPage.test.tsx @@ -18,40 +18,45 @@ beforeEach(() => { mockValues = [{ value: 'Sign up' }, { value: 'Purchase' }]; }); -vi.mock('@umami/react-zen', () => ({ - Column: ({ children }: { children: ReactNode }) =>
{children}
, - Grid: ({ children }: { children: ReactNode }) =>
{children}
, - ListItem: ({ id, children }: { id: string; children: ReactNode }) => ( - - ), - Select: ({ - label, - value, - defaultValue, - placeholder, - onChange, - children, - }: { - label: string; - value?: string; - defaultValue?: string; - placeholder?: string; - onChange?: (value: string) => void; - children: ReactNode; - }) => ( - - ), -})); +vi.mock('@umami/react-zen', async importOriginal => { + const actual = await importOriginal(); + + return { + ...actual, + Column: ({ children }: { children: ReactNode }) =>
{children}
, + Grid: ({ children }: { children: ReactNode }) =>
{children}
, + ListItem: ({ id, children }: { id: string; children: ReactNode }) => ( + + ), + Select: ({ + label, + value, + defaultValue, + placeholder, + onChange, + children, + }: { + label: string; + value?: string; + defaultValue?: string; + placeholder?: string; + onChange?: (value: string) => void; + children: ReactNode; + }) => ( + + ), + }; +}); vi.mock('@/components/common/Empty', () => ({ Empty: () =>
Empty
, @@ -72,6 +77,9 @@ vi.mock('@/components/hooks', () => ({ viewedPage: 'Viewed Page', triggeredEvent: 'Triggered Event', }, + messages: { + noResultsFound: 'No results found', + }, }), useWebsiteValuesQuery: () => ({ data: mockValues, @@ -79,6 +87,30 @@ vi.mock('@/components/hooks', () => ({ }), })); +vi.mock('@/components/input/WebsiteValueComboBox', () => ({ + WebsiteValueComboBox: ({ + label, + value, + onChange, + }: { + label: string; + value: string; + onChange: (value: string) => void; + }) => ( + + ), +})); + vi.mock('@/app/(main)/websites/[websiteId]/WebsiteControls', () => ({ WebsiteControls: () =>
WebsiteControls
, }));