fix(web): SpaceInviteCard navigates to /channels/:spaceId (not the non-existent /spaces/:id)

This commit is contained in:
Jannis Braun
2026-04-29 22:44:35 +02:00
parent d8b08d8990
commit 85987a891c
2 changed files with 6 additions and 3 deletions
@@ -96,6 +96,9 @@ describe('SpaceInviteCard', () => {
// Specifically NOT called with empty string or undefined
expect(mockJoinByCode).not.toHaveBeenCalledWith('abc', '');
expect(mockJoinByCode).not.toHaveBeenCalledWith('abc', undefined);
// After a successful join, the app must navigate to the space via the real
// route (/channels/:spaceId), not the non-existent /spaces/:id route.
await waitFor(() => expect(mockNavigate).toHaveBeenCalledWith('/channels/S1'));
});
it('navigates to space when join returns "already a member" (no error shown)', async () => {
@@ -111,7 +114,7 @@ describe('SpaceInviteCard', () => {
const btn = await screen.findByRole('button', { name: /^join$/i });
await user.click(btn);
await waitFor(() => expect(mockNavigate).toHaveBeenCalledWith('/spaces/S1'));
await waitFor(() => expect(mockNavigate).toHaveBeenCalledWith('/channels/S1'));
expect(screen.queryByText(/already a member of this space/i)).not.toBeInTheDocument();
});
});