fix rpg agent refresh restore route
This commit is contained in:
@@ -1556,6 +1556,47 @@ test('restoring an agent workspace ignores a stored session owned by another use
|
||||
expect(window.location.search).toBe('');
|
||||
});
|
||||
|
||||
test('refreshing platform home ignores stored agent workspace pointer without explicit restore path', async () => {
|
||||
window.sessionStorage.setItem(
|
||||
'genarrative.custom-world-agent-ui.v1',
|
||||
JSON.stringify({
|
||||
activeSessionId: 'custom-world-agent-session-1',
|
||||
activeOperationId: null,
|
||||
ownerUserId: 'user-1',
|
||||
}),
|
||||
);
|
||||
|
||||
render(<TestWrapper withAuth />);
|
||||
|
||||
expect(await screen.findByRole('button', { name: '创作' })).toBeTruthy();
|
||||
expect(screen.queryByText(/Agent工作区/u)).toBeNull();
|
||||
expect(getRpgCreationSession).not.toHaveBeenCalled();
|
||||
expect(window.location.pathname).toBe('/');
|
||||
});
|
||||
|
||||
test('refreshing RPG agent path restores stored agent workspace pointer', async () => {
|
||||
window.history.replaceState(null, '', '/creation/rpg/agent');
|
||||
window.sessionStorage.setItem(
|
||||
'genarrative.custom-world-agent-ui.v1',
|
||||
JSON.stringify({
|
||||
activeSessionId: 'custom-world-agent-session-1',
|
||||
activeOperationId: null,
|
||||
ownerUserId: 'user-1',
|
||||
}),
|
||||
);
|
||||
|
||||
render(<TestWrapper withAuth />);
|
||||
|
||||
await waitFor(() => {
|
||||
expect(getRpgCreationSession).toHaveBeenCalledWith(
|
||||
'custom-world-agent-session-1',
|
||||
);
|
||||
});
|
||||
expect(
|
||||
await screen.findByText('Agent工作区:custom-world-agent-session-1'),
|
||||
).toBeTruthy();
|
||||
});
|
||||
|
||||
test('new creation entry maps raw bearer token errors to user-facing auth copy', async () => {
|
||||
const user = userEvent.setup();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user