fix: keep recommend runtime on local auth

This commit is contained in:
2026-05-25 22:45:29 +08:00
parent 21d95a18d3
commit 62a24bf0e5
6 changed files with 43 additions and 17 deletions

View File

@@ -2783,19 +2783,28 @@ test('logged out desktop recommend rail enters runtime without login modal', asy
const user = userEvent.setup();
const openLoginModal = vi.fn();
renderLoggedOutHomeView(
const { container } = renderLoggedOutHomeView(
openLoginModal,
{
latestEntries: [puzzlePublicEntry],
activeRecommendEntryKey: 'puzzle:user-2:puzzle-profile-public-1',
},
'category',
true,
);
await user.click(screen.getByRole('button', { name: '推荐' }));
const desktopRail = container.querySelector('.platform-desktop-rail');
if (!desktopRail) {
throw new Error('缺少桌面侧边栏');
}
await user.click(
within(desktopRail as HTMLElement).getByRole('button', { name: '推荐' }),
);
expect(openLoginModal).not.toHaveBeenCalled();
expect(screen.getByTestId('recommend-runtime')).toBeTruthy();
expect(screen.queryByTestId('recommend-runtime')).toBeNull();
expect(container.querySelector('.platform-desktop-shell')).toBeTruthy();
});
test('logged in recommend page uses gated recommend detail callback', async () => {