Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
joel-jeremy committed Jan 22, 2025
1 parent bbc9bdc commit e66414a
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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<typeof import('../../hooks/usePayees')>();
return {
...actual,
usePayees: () => payees,
};
});

const categoryGroups = generateCategoryGroups([
{
name: 'Investments and Savings',
Expand All @@ -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(
Expand Down Expand Up @@ -214,7 +234,7 @@ function initBasicServer() {
return { data: accounts, dependencies: [] };
case 'transactions':
return {
data: [],
data: generateTransactions(5, [6]),
dependencies: [],
};
default:
Expand Down
2 changes: 1 addition & 1 deletion packages/desktop-client/src/hooks/useDisplayPayee.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit e66414a

Please sign in to comment.