Skip to content

Commit

Permalink
Patch lint & test
Browse files Browse the repository at this point in the history
  • Loading branch information
MatissJanis committed Jan 7, 2025
1 parent 5269d52 commit 1ed938d
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 17 deletions.
2 changes: 1 addition & 1 deletion packages/desktop-client/globals.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ declare module 'react' {
}

declare global {
var __resetWorld: () => void;
function __resetWorld(): void;
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState, useEffect, type ComponentProps } from 'react';
import React, { useState, useEffect } from 'react';

import { render, screen, fireEvent } from '@testing-library/react';
import userEvent from '@testing-library/user-event';
Expand All @@ -21,20 +21,20 @@ import {
updateTransaction,
} from 'loot-core/src/shared/transactions';
import { integerToCurrency } from 'loot-core/src/shared/util';
import {
type AccountEntity,
type CategoryEntity,
type CategoryGroupEntity,
type PayeeEntity,
type TransactionEntity,
} from 'loot-core/types/models';

import { AuthProvider } from '../../auth/AuthProvider';
import { SelectedProviderWithItems } from '../../hooks/useSelected';
import { SplitsExpandedProvider } from '../../hooks/useSplitsExpanded';
import { ResponsiveProvider } from '../responsive/ResponsiveProvider';

import { TransactionTable } from './TransactionsTable';
import {
AccountEntity,
CategoryEntity,
CategoryGroupEntity,
PayeeEntity,
TransactionEntity,
} from 'loot-core/types/models';

vi.mock('loot-core/src/platform/client/fetch');
vi.mock('../../hooks/useFeatureFlag', () => ({
Expand Down Expand Up @@ -135,6 +135,7 @@ function LiveTransactionTable(props: LiveTransactionTableProps) {
useEffect(() => {
if (transactions === props.transactions) return;
props.onTransactionsChange?.(transactions);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [transactions]);

const onSplit = (id: string) => {
Expand Down Expand Up @@ -1017,7 +1018,7 @@ describe('Transactions', () => {
category: undefined,
cleared: false,
date: '2017-01-01',
error: null,
error: undefined,
id: expect.any(String),
is_parent: true,
notes: 'Notes',
Expand All @@ -1035,6 +1036,7 @@ describe('Transactions', () => {
is_child: true,
parent_id: parentId,
payee: 'alice-id',
reconciled: undefined,
sort_order: -1,
starting_balance_flag: null,
},
Expand All @@ -1049,6 +1051,7 @@ describe('Transactions', () => {
is_child: true,
parent_id: parentId,
payee: 'alice-id',
reconciled: undefined,
sort_order: -2,
starting_balance_flag: null,
},
Expand Down
2 changes: 1 addition & 1 deletion packages/loot-core/src/platform/client/fetch/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { CategoryGroupEntity } from '../../..//types/models';
import type { Handlers } from '../../../types/handlers';
import type { CategoryGroupEntity } from '../../../types/models';
import type { ServerEvents } from '../../../types/server-events';

export function init(socketName: string): Promise<unknown>;
Expand Down
6 changes: 0 additions & 6 deletions packages/loot-core/src/server/accounts/rules.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,6 @@ describe('Rule', () => {
expect(
fixedAmountRule.exec({ imported_payee: 'James', amount: 200 }),
).toMatchObject({
error: null,
subtransactions: [{ amount: 100 }, { amount: 100 }],
});
});
Expand All @@ -571,7 +570,6 @@ describe('Rule', () => {

expect(rule.exec({ imported_payee: 'James', amount: 200 })).toMatchObject(
{
error: null,
subtransactions: [{ amount: 100 }, { amount: 100 }],
},
);
Expand All @@ -597,7 +595,6 @@ describe('Rule', () => {

expect(rule.exec({ imported_payee: 'James', amount: 200 })).toMatchObject(
{
error: null,
subtransactions: [{ amount: 100 }, { amount: 100 }],
},
);
Expand Down Expand Up @@ -632,7 +629,6 @@ describe('Rule', () => {
expect(
prioritizationRule.exec({ imported_payee: 'James', amount: 200 }),
).toMatchObject({
error: null,
subtransactions: [{ amount: 100 }, { amount: 50 }, { amount: 50 }],
});
});
Expand All @@ -642,7 +638,6 @@ describe('Rule', () => {
expect(
prioritizationRule.exec({ imported_payee: 'James', amount: 50 }),
).toMatchObject({
error: null,
subtransactions: [{ amount: 100 }, { amount: -25 }, { amount: -25 }],
});
});
Expand Down Expand Up @@ -674,7 +669,6 @@ describe('Rule', () => {

expect(rule.exec({ imported_payee: 'James', amount: 150 })).toMatchObject(
{
error: null,
subtransactions: [{ amount: 100 }, { amount: 50 }, { amount: 0 }],
},
);
Expand Down

0 comments on commit 1ed938d

Please sign in to comment.