Hide recharge entry from account menu

This commit is contained in:
鲨鱼辣椒 committed 2026-10-13 17:56:11 +08:00
1 parent 10da39341e
commit e9171208e6
6 files changed
+112 -61

No files matched your search

+8 -4
View File
@@ -85,13 +85,17 @@ describe('Sidebar permanent point wallet', () => {
fetchBillingSummaryMock.mockReset();
fetchBillingSummaryMock.mockResolvedValue(billingSummary());
});
it('opens the point wallet from the account menu without retired member controls', async () => {
it('keeps the balance and account controls while hiding the recharge entry', async () => {
await openAccount();
await waitFor(() => expect(screen.getByTestId('sidebar-total-token-points')).toHaveTextContent('75 点'));
expect(screen.queryByText(/重置卡|升级订阅|会员等级|本周剩余/)).not.toBeInTheDocument();
fireEvent.click(screen.getByTestId('sidebar-point-wallet-open'));
expect(screen.getByTestId('point-wallet-dialog')).toHaveTextContent('1 元充值 50 点');
expect(screen.getByTestId('point-recharge-recipient')).toHaveTextContent('测试用户(member@example.com)');
expect(screen.getByTestId('sidebar-point-balance')).toHaveTextContent('永久有效 · 预占 5 点');
expect(screen.queryByTestId('sidebar-point-wallet-open')).not.toBeInTheDocument();
expect(screen.queryByRole('menuitem', { name: '词元点数与充值' })).not.toBeInTheDocument();
expect(screen.queryByTestId('point-wallet-dialog')).not.toBeInTheDocument();
expect(screen.getByRole('menuitem', { name: '个人资料' })).toBeVisible();
expect(screen.getByRole('menuitem', { name: '设置' })).toBeVisible();
expect(screen.getByRole('menuitem', { name: '退出登录' })).toBeVisible();
});
it('shows a retryable failure without inventing a zero balance', async () => {
fetchBillingSummaryMock.mockRejectedValue(new Error('offline'));