diff --git a/resources/js/pages/Accounts/Show.test.tsx b/resources/js/pages/Accounts/Show.test.tsx index b0d16e9f..22d435bf 100644 --- a/resources/js/pages/Accounts/Show.test.tsx +++ b/resources/js/pages/Accounts/Show.test.tsx @@ -1,4 +1,5 @@ -import { fireEvent, render, screen } from '@testing-library/react'; +import { router } from '@inertiajs/react'; +import { act, fireEvent, render, screen } from '@testing-library/react'; import { type ReactNode } from 'react'; import { describe, expect, it, vi } from 'vitest'; @@ -116,6 +117,17 @@ describe('AccountShow', () => { ); }); + it('reloads only the deferred transactions prop after a transaction is created', () => { + renderPage(); + + const { onSuccess } = editTransactionDialog.mock.calls.at(-1)![0] as { + onSuccess: () => void; + }; + act(() => onSuccess()); + + expect(router.reload).toHaveBeenCalledWith({ only: ['transactions'] }); + }); + it('hides transaction action for connected accounts', () => { renderPage({ ...baseAccount,