diff --git a/packages/desktop-client/src/components/transactions/TransactionsTable.test.tsx b/packages/desktop-client/src/components/transactions/TransactionsTable.test.tsx index b821340b346..f57ab868f8a 100644 --- a/packages/desktop-client/src/components/transactions/TransactionsTable.test.tsx +++ b/packages/desktop-client/src/components/transactions/TransactionsTable.test.tsx @@ -48,6 +48,10 @@ vi.mock('../../hooks/useFeatureFlag', () => ({ })); const accounts = [generateAccount('Bank of America')]; +vi.mock('../../hooks/useAccounts', () => ({ + useAccounts: () => accounts, +})); + const payees: PayeeEntity[] = [ { id: 'bob-id', @@ -65,6 +69,15 @@ const payees: PayeeEntity[] = [ name: 'This guy on the side of the road', }, ]; +vi.mock('../../hooks/usePayees', async importOriginal => { + // eslint-disable-next-line @typescript-eslint/consistent-type-imports + const actual = await importOriginal(); + return { + ...actual, + usePayees: () => payees, + }; +}); + const categoryGroups = generateCategoryGroups([ { name: 'Investments and Savings', @@ -79,6 +92,13 @@ const categoryGroups = generateCategoryGroups([ categories: [{ name: 'Big Projects' }, { name: 'Shed' }], }, ]); +vi.mock('../../hooks/useCategories', () => ({ + useCategories: () => ({ + list: categoryGroups.flatMap(g => g.categories), + grouped: categoryGroups, + }), +})); + const usualGroup = categoryGroups[1]; function generateTransactions( @@ -214,7 +234,7 @@ function initBasicServer() { return { data: accounts, dependencies: [] }; case 'transactions': return { - data: [], + data: generateTransactions(5, [6]), dependencies: [], }; default: diff --git a/packages/desktop-client/src/hooks/useDisplayPayee.ts b/packages/desktop-client/src/hooks/useDisplayPayee.ts index 1636b837bea..276ac00fd94 100644 --- a/packages/desktop-client/src/hooks/useDisplayPayee.ts +++ b/packages/desktop-client/src/hooks/useDisplayPayee.ts @@ -36,7 +36,7 @@ export function useDisplayPayee({ transaction }: UseDisplayPayeeProps) { const payee = usePayee(transaction?.payee || ''); return useMemo(() => { - if (subtransactions?.length === 0) { + if (subtransactions.length === 0) { return getPrettyPayee({ transaction, payee,