/* @vitest-environment jsdom */ import { render, screen, within } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import { describe, expect, test, vi } from 'vitest'; import { PlatformProfileWalletLedgerModal } from './PlatformProfileWalletLedgerModal'; describe('PlatformProfileWalletLedgerModal', () => { test('renders ledger entries with shared balance presentation', () => { render( , ); const dialog = screen.getByRole('dialog', { name: '泥点账单' }); expect(within(dialog).getByText('88泥点')).toBeTruthy(); expect(within(dialog).getByText('每日任务奖励')).toBeTruthy(); expect(within(dialog).getByText('+12')).toBeTruthy(); expect(within(dialog).getByText('余额 88')).toBeTruthy(); }); test('retries from the shared error state', async () => { const user = userEvent.setup(); const onRetry = vi.fn(); render( , ); await user.click(screen.getByRole('button', { name: '重新加载' })); expect(onRetry).toHaveBeenCalledTimes(1); }); });