Skip to content

Commit 65e137b

Browse files
committed
test: fix tests
1 parent 2cdbcf1 commit 65e137b

8 files changed

Lines changed: 7 additions & 21 deletions

File tree

app/i18n/messages/en.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,6 @@
620620
"team": "Team",
621621
"create-team": "Create a team",
622622
"profile": "Profile",
623-
"switch-to-regular-user-mode": "Switch to regular user mode",
624623
"sign-out": "Sign out"
625624
},
626625
"createTeam": {

app/i18n/messages/fr.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
"team": "Équipe",
1414
"create-team": "Créer une équipe",
1515
"profile": "Profil",
16-
"switch-to-regular-user-mode": "Passer en mode utilisateur",
1716
"sign-out": "Se déconnecter"
1817
},
1918
"createTeam": {

components/providers/active-account-provider.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import { createContext, useContext, useState, useEffect } from "react";
44
import { z } from "zod";
5+
import { getQueryClient } from "@/lib/get-query-client";
56

67
const activeAccountSchema = z.object({
78
type: z.enum(["personal", "team"]),
@@ -59,6 +60,7 @@ function ActiveAccountProvider({ children }: { children: React.ReactNode }) {
5960
const switchAccount = (account: ActiveAccount) => {
6061
setActiveAccount(account);
6162
localStorage.setItem(STORAGE_KEY, JSON.stringify(account));
63+
getQueryClient().invalidateQueries();
6264
};
6365

6466
return (

cypress/e2e/dashboard.cy.ts

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -56,21 +56,6 @@ describe("dashboard", () => {
5656

5757
// check we are on home page
5858
cy.location("pathname", { timeout: 10000 }).should("eq", "/");
59-
60-
// come back to dashboard
61-
cy.visit("/dashboard");
62-
63-
// click on Avatar menu to go to home
64-
cy.get('img[alt="Avatar"]', { timeout: 15000 })
65-
.first()
66-
.should("be.visible")
67-
.click();
68-
69-
// click on home link
70-
cy.get("a").contains("Switch to regular user mode").click();
71-
72-
// check we are on home page
73-
cy.location("pathname").should("eq", "/");
7459
});
7560

7661
it("navigate to profile from dashboard", () => {

hooks/use-header-builder.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { useActiveAccount } from "@/components/providers/active-account-provider";
2-
3-
const TEAM_ACTOR_HEADER = "X-Team-Id";
2+
import { TEAM_ACTOR_HEADER } from "@/lib/constants";
43

54
export function useHeaderBuilder() {
65
const { activeAccount, isTeamContext } = useActiveAccount();

lib/constants.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export const TEAM_ACTOR_HEADER = "X-Team-Id";

lib/queries/build-query-headers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const TEAM_ACTOR_HEADER = "X-Team-Id";
1+
import { TEAM_ACTOR_HEADER } from "@/lib/constants";
22

33
export function buildQueryHeaders(
44
token: string | null,

lib/queries/team.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import { queryOptions } from "@tanstack/react-query";
2+
import { GetToken } from "@clerk/types";
23
import { withSpan } from "../tracer";
34
import { zenaoClient } from "../zenao-client";
45
import type { UserTeam } from "@/app/gen/zenao/v1/zenao_pb";
56

67
export const userTeamsOptions = (
7-
getToken: () => Promise<string | null>,
8+
getToken: GetToken,
89
userId: string | null | undefined,
910
) => {
1011
return queryOptions<UserTeam[]>({

0 commit comments

Comments
 (0)