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:
parent
c0ad01cfe3
commit
bb7e2faab8
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in New Issue