@@ -692,6 +692,7 @@ afterEach(() => {
|
||||
configurable: true,
|
||||
value: undefined,
|
||||
});
|
||||
window.history.replaceState(null, '', '/');
|
||||
});
|
||||
|
||||
test('opens wallet ledger modal from narrative coin card', async () => {
|
||||
@@ -859,6 +860,37 @@ test('profile redeem invite shortcut hides after redeemed or one day old', async
|
||||
).toBeNull();
|
||||
});
|
||||
|
||||
|
||||
test('invite query opens login modal for logged out users', async () => {
|
||||
const openLoginModal = vi.fn();
|
||||
window.history.replaceState(null, '', '/?inviteCode=spring-2026');
|
||||
|
||||
renderLoggedOutHomeView(openLoginModal);
|
||||
|
||||
await waitFor(() => {
|
||||
expect(openLoginModal).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
});
|
||||
|
||||
test('invite query opens redeem modal directly for logged in users', async () => {
|
||||
window.history.replaceState(null, '', '/?inviteCode=spring-2026');
|
||||
|
||||
renderProfileView();
|
||||
|
||||
const input = await screen.findByLabelText('邀请码');
|
||||
expect((input as HTMLInputElement).value).toBe('SPRING2026');
|
||||
});
|
||||
|
||||
test('profile redeem invite modal reads query invite code after login', async () => {
|
||||
window.history.replaceState(null, '', '/?inviteCode=spring-2026');
|
||||
|
||||
renderProfileView();
|
||||
|
||||
const input = await screen.findByLabelText('邀请码');
|
||||
|
||||
expect((input as HTMLInputElement).value).toBe('SPRING2026');
|
||||
});
|
||||
|
||||
test('profile redeem invite modal submits code and hides shortcut after success', async () => {
|
||||
const user = userEvent.setup();
|
||||
const onRechargeSuccess = vi.fn();
|
||||
|
||||
Reference in New Issue
Block a user