Skip to content

Commit

Permalink
Merge branch 'master' into autofocus
Browse files Browse the repository at this point in the history
  • Loading branch information
psybers committed Jul 12, 2024
2 parents e12f892 + 4a0e2ea commit aa9c973
Show file tree
Hide file tree
Showing 39 changed files with 395 additions and 530 deletions.
37 changes: 0 additions & 37 deletions .github/workflows/trafico.yml

This file was deleted.

27 changes: 0 additions & 27 deletions .github/workflows/wip.yml

This file was deleted.

23 changes: 22 additions & 1 deletion packages/api/methods.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,19 @@ describe('API CRUD operations', () => {
await api.loadBudget(budgetName);
});

// api: getBudgets
test('getBudgets', async () => {
const budgets = await api.getBudgets();
expect(budgets).toEqual(
expect.arrayContaining([
expect.objectContaining({
id: 'test-budget',
name: 'Default Test Db',
}),
]),
);
});

// apis: getCategoryGroups, createCategoryGroup, updateCategoryGroup, deleteCategoryGroup
test('CategoryGroups: successfully update category groups', async () => {
const month = '2023-10';
Expand Down Expand Up @@ -251,7 +264,7 @@ describe('API CRUD operations', () => {
);
});

//apis: createAccount, getAccounts, updateAccount, closeAccount, deleteAccount, reopenAccount
//apis: createAccount, getAccounts, updateAccount, closeAccount, deleteAccount, reopenAccount, getAccountBalance
test('Accounts: successfully complete account operators', async () => {
const accountId1 = await api.createAccount(
{ name: 'test-account1', offbudget: true },
Expand All @@ -272,6 +285,9 @@ describe('API CRUD operations', () => {
]),
);

expect(await api.getAccountBalance(accountId1)).toEqual(1000);
expect(await api.getAccountBalance(accountId2)).toEqual(0);

await api.updateAccount(accountId1, { offbudget: false });
await api.closeAccount(accountId1, accountId2, null);
await api.deleteAccount(accountId2);
Expand Down Expand Up @@ -569,6 +585,11 @@ describe('API CRUD operations', () => {
});
expect(addResult).toBe('ok');

expect(await api.getAccountBalance(accountId)).toEqual(200);
expect(
await api.getAccountBalance(accountId, new Date(2023, 10, 2)),
).toEqual(0);

// confirm added transactions exist
let transactions = await api.getTransactions(
accountId,
Expand Down
12 changes: 12 additions & 0 deletions packages/api/methods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ export async function downloadBudget(syncId, { password }: { password? } = {}) {
return send('api/download-budget', { syncId, password });
}

export async function getBudgets() {
return send('api/get-budgets');
}

export async function sync() {
return send('api/sync');
}
Expand Down Expand Up @@ -125,6 +129,10 @@ export function deleteAccount(id) {
return send('api/account-delete', { id });
}

export function getAccountBalance(id, cutoff?) {
return send('api/account-balance', { id, cutoff });
}

export function getCategoryGroups() {
return send('api/category-groups-get');
}
Expand Down Expand Up @@ -173,6 +181,10 @@ export function deletePayee(id) {
return send('api/payee-delete', { id });
}

export function mergePayees(targetId, mergeIds) {
return send('api/payees-merge', { targetId, mergeIds });
}

export function getRules() {
return send('api/rules-get');
}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 8 additions & 10 deletions packages/desktop-client/src/components/FinancesApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import { ScrollProvider } from './ScrollProvider';
import { Settings } from './settings';
import { FloatableSidebar } from './sidebar';
import { SidebarProvider } from './sidebar/SidebarProvider';
import { Titlebar, TitlebarProvider } from './Titlebar';
import { Titlebar } from './Titlebar';

function NarrowNotSupported({
redirectTo = '/budget',
Expand Down Expand Up @@ -246,15 +246,13 @@ export function FinancesApp() {

return (
<SpreadsheetProvider>
<TitlebarProvider>
<SidebarProvider>
<BudgetMonthCountProvider>
<DndProvider backend={Backend}>
<ScrollProvider>{app}</ScrollProvider>
</DndProvider>
</BudgetMonthCountProvider>
</SidebarProvider>
</TitlebarProvider>
<SidebarProvider>
<BudgetMonthCountProvider>
<DndProvider backend={Backend}>
<ScrollProvider>{app}</ScrollProvider>
</DndProvider>
</BudgetMonthCountProvider>
</SidebarProvider>
</SpreadsheetProvider>
);
}
11 changes: 0 additions & 11 deletions packages/desktop-client/src/components/Modals.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ import { ScheduledTransactionMenuModal } from './modals/ScheduledTransactionMenu
import { SelectLinkedAccounts } from './modals/SelectLinkedAccounts';
import { SimpleFinInitialise } from './modals/SimpleFinInitialise';
import { SingleInputModal } from './modals/SingleInputModal';
import { SwitchBudgetTypeModal } from './modals/SwitchBudgetTypeModal';
import { TransferModal } from './modals/TransferModal';
import { DiscoverSchedules } from './schedules/DiscoverSchedules';
import { PostsOfflineNotification } from './schedules/PostsOfflineNotification';
Expand Down Expand Up @@ -423,15 +422,6 @@ export function Modals() {
/>
);

case 'switch-budget-type':
return (
<SwitchBudgetTypeModal
key={name}
modalProps={modalProps}
onSwitch={options.onSwitch}
/>
);

case 'account-menu':
return (
<AccountMenuModal
Expand Down Expand Up @@ -623,7 +613,6 @@ export function Modals() {
onAddCategoryGroup={options.onAddCategoryGroup}
onToggleHiddenCategories={options.onToggleHiddenCategories}
onSwitchBudgetFile={options.onSwitchBudgetFile}
onSwitchBudgetType={options.onSwitchBudgetType}
/>
);

Expand Down
Loading

0 comments on commit aa9c973

Please sign in to comment.