test(accounts): cover the deferred-transactions reload on create

Deferring the ledger makes the post-create refresh load-bearing on
deferred-prop semantics: handleTransactionCreated now relies on
router.reload({ only: ['transactions'] }) re-resolving the deferred
closure instead of remounting the list. Assert that contract so a
regression in the reload target is caught.
This commit is contained in:
Víctor Falcón 2026-07-03 17:16:00 +02:00
parent c0ad01cfe3
commit bb7e2faab8
1 changed files with 13 additions and 1 deletions

View File

@ -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,