Merge hidden recharge entry across sidebar and standalone account menus

This commit is contained in:
鲨鱼辣椒 committed 2026-10-13 20:07:18 +08:00
commit 5d500a932f
8 files changed
+45 -83

No files matched your search

+5 -9
View File
@@ -46,7 +46,7 @@ beforeEach(() => {
});
afterEach(cleanup);
it('shows the authenticated account and opens the real personal wallet with read requests only', async () => {
it('shows the authenticated account balance and controls without a recharge entry', async () => {
renderHome();
const trigger = await screen.findByTestId('home-account-menu-trigger');
await waitFor(() => expect(trigger).toHaveTextContent('小麦'));
@@ -56,14 +56,10 @@ it('shows the authenticated account and opens the real personal wallet with read
expect(trigger).toHaveAttribute('aria-expanded', 'true');
expect(await within(menu).findByTestId('sidebar-total-token-points')).toHaveTextContent('75 点');
expect(within(menu).getByText('永久有效 · 预占 5 点', { exact: true })).toBeInTheDocument();
fireEvent.click(within(menu).getByRole('menuitem', { name: '词元点数与充值', exact: true }));
const dialog = await screen.findByTestId('point-wallet-dialog');
await waitFor(() => expect(within(dialog).getByRole('button', { name: /500 点\s*¥10.00/ })).toBeEnabled());
expect(within(dialog).getByTestId('point-recharge-recipient')).toHaveTextContent('充值到:小麦(child-wallet)');
expect(api.fetch).toHaveBeenCalledWith('/api/works/billing/recharge/orders?offset=0', undefined);
fireEvent.mouseDown(within(dialog).getByText('我的可用点数', { exact: true }));
expect(trigger).toHaveAttribute('aria-expanded', 'false');
expect(dialog).toBeVisible();
expect(within(menu).queryByRole('menuitem', { name: '词元点数与充值', exact: true })).not.toBeInTheDocument();
expect(screen.queryByTestId('point-wallet-dialog')).not.toBeInTheDocument();
for (const name of ['个人资料', '设置', '退出登录']) expect(within(menu).getByRole('menuitem', { name, exact: true })).toBeVisible();
expect(api.fetch.mock.calls.filter(([path]) => path.includes('/billing/recharge/') || path.includes('/billing/points/transactions'))).toEqual([]);
expect(writes()).toEqual([]);
});