diff --git a/apps/e2e/tests/backend/endpoints/api/v1/teams.test.ts b/apps/e2e/tests/backend/endpoints/api/v1/teams.test.ts index fa1ee86a5..3e2340d44 100644 --- a/apps/e2e/tests/backend/endpoints/api/v1/teams.test.ts +++ b/apps/e2e/tests/backend/endpoints/api/v1/teams.test.ts @@ -81,7 +81,6 @@ it("lists all the teams the current user has on the server", async ({ expect }) `); }); - it("creates a team on the client", async ({ expect }) => { await Auth.Otp.signIn(); const { createTeamResponse: response } = await Team.create(); @@ -116,7 +115,7 @@ it("creates a team on the server", async ({ expect }) => { `); }); -it("gets a specific team", async ({ expect }) => { +it("gets a specific team on the client", async ({ expect }) => { await Auth.Otp.signIn(); const { createTeamResponse: response, teamId } = await Team.create(); expect(response).toMatchInlineSnapshot(` @@ -146,6 +145,35 @@ it("gets a specific team", async ({ expect }) => { `); }); +it("gets a specific team that the user is not part of on the client", async ({ expect }) => { + await Auth.Otp.signIn(); + const { createTeamResponse: response, teamId } = await Team.create(); + + backendContext.set({ + mailbox: createMailbox() + }); + await Auth.Otp.signIn(); + + const response2 = await niceBackendFetch(`/api/v1/teams/${teamId}`, { accessType: "client" }); + expect(response2).toMatchInlineSnapshot(` + NiceResponse { + "status": 404, + "body": { + "code": "TEAM_MEMBERSHIP_NOT_FOUND", + "details": { + "team_id": "", + "user_id": "", + }, + "error": "User is not found in team .", + }, + "headers": Headers { + "x-stack-known-error": "TEAM_MEMBERSHIP_NOT_FOUND", +