Skip to content

Commit

Permalink
fixup! 4. Summary page
Browse files Browse the repository at this point in the history
  • Loading branch information
dr-bizz committed Oct 11, 2024
1 parent 9f31f3c commit 13de482
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
} from './AccountSummary';
import {
creditByCategories,
defaultFinancialAccount,
defaultFinancialAccountSummary,
} from './AccountSummaryMock';
import { FinancialAccountSummaryQuery } from './financialAccountSummary.generated';
Expand All @@ -31,6 +32,8 @@ const router = {
query: { accountListId },
isReady: true,
};
const startDate = '2024-01-01';
const endDate = '2024-01-31';
const mutationSpy = jest.fn();

const Component = () => (
Expand All @@ -53,6 +56,10 @@ const Component = () => (
{
accountListId,
financialAccountId,
financialAccountsQuery: {
data: defaultFinancialAccount,
loading: false,
},
} as unknown as FinancialAccountType
}
>
Expand Down Expand Up @@ -88,6 +95,8 @@ describe('AccountSummary', () => {
categories:
creditByCategories as AppendCategoryToCategoriesArray['categories'],
categoryArray,
startDate,
endDate,
index: 0,
});

Expand All @@ -96,12 +105,24 @@ describe('AccountSummary', () => {
{
id: '111',
name: 'Category 1',
amounts: [5000],
months: [
{
amount: 5000,
endDate,
startDate,
},
],
},
{
id: '222',
name: 'Code 2',
amounts: [5000],
months: [
{
amount: 5000,
endDate,
startDate,
},
],
},
]);

Expand All @@ -117,6 +138,8 @@ describe('AccountSummary', () => {
},
] as AppendCategoryToCategoriesArray['categories'],
categoryArray,
startDate: '2024-02-01',
endDate: '2024-02-29',
index: 1,
});

Expand All @@ -125,12 +148,34 @@ describe('AccountSummary', () => {
{
id: '111',
name: 'Category 1',
amounts: [5000, 3000],
months: [
{
amount: 5000,
endDate,
startDate,
},
{
amount: 3000,
startDate: '2024-02-01',
endDate: '2024-02-29',
},
],
},
{
id: '222',
name: 'Code 2',
amounts: [5000, 6000],
months: [
{
amount: 5000,
endDate,
startDate,
},
{
amount: 6000,
startDate: '2024-02-01',
endDate: '2024-02-29',
},
],
},
]);
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,37 @@
import { FinancialAccountQuery } from '../Context/FinancialAccount.generated';

export const defaultFinancialAccount: FinancialAccountQuery = {
financialAccount: {
id: 'abc123',
code: 'accountCode',
name: 'Account 1',
balance: {
convertedAmount: 1000,
convertedCurrency: 'USD',
},
categories: {
nodes: [
{
id: '1',
code: '100',
entryType: 'CREDIT',
name: 'Category 1',
},
{
id: '2',
code: '200',
entryType: 'DEBIT',
name: 'Category 2',
},
],
},
organization: {
id: '1',
name: 'Organization 1',
},
},
};

export const creditByCategories = [
{
amount: '-5000',
Expand Down

0 comments on commit 13de482

Please sign in to comment.