fix: route creation wallet chip to top-up entry

This commit is contained in:
2026-06-03 19:54:27 +08:00
parent 84e5740e6d
commit 01a68bcf3d
4 changed files with 40 additions and 2 deletions

View File

@@ -3137,6 +3137,41 @@ test('logged in create tab shows real wallet balance beside the brand', () => {
expect(topbar?.textContent).toContain('1,234泥点');
});
test('create tab wallet chip opens reward code when recharge entry is hidden', async () => {
const user = userEvent.setup();
mockNarrowMobileLayout();
render(
<ProfileHomeViewHarness
activeTab="create"
profileDashboardOverrides={{ walletBalance: 70 }}
/>,
);
await user.click(screen.getByRole('button', { name: /^70$/u }));
expect(await screen.findByPlaceholderText('输入兑换码')).toBeTruthy();
expect(mockGetRpgProfileRechargeCenter).not.toHaveBeenCalled();
});
test('create tab wallet chip opens recharge when recharge entry is enabled', async () => {
const user = userEvent.setup();
mockWechatDesktopLayout();
render(
<ProfileHomeViewHarness
activeTab="create"
profileDashboardOverrides={{ walletBalance: 70 }}
/>,
);
await user.click(screen.getByRole('button', { name: /^70$/u }));
expect(await screen.findByText('账户充值')).toBeTruthy();
expect(mockGetRpgProfileRechargeCenter).toHaveBeenCalledTimes(1);
expect(screen.queryByPlaceholderText('输入兑换码')).toBeNull();
});
test('mobile discover search submits public work code', async () => {
const user = userEvent.setup();
const onSearchPublicCode = vi.fn();