This commit is contained in:
2025-12-12 23:49:56 +01:00
parent cae81b1088
commit 8f1db21fb1
29 changed files with 879 additions and 399 deletions

View File

@@ -45,8 +45,8 @@ vi.mock('../../../apps/website/lib/auth/AuthContext', () => {
refreshSession: async () => {},
});
const AuthProvider = ({ value, children }: { value: any; children: React.ReactNode }) => (
<AuthContext.Provider value={value}>{children}</AuthContext.Provider>
const AuthProvider = ({ initialSession, children }: { initialSession?: any; children: React.ReactNode }) => (
<AuthContext.Provider value={{ session: initialSession, loading: false, login: () => {}, logout: async () => {}, refreshSession: async () => {} }}>{children}</AuthContext.Provider>
);
const useAuth = () => React.useContext(AuthContext);
@@ -65,13 +65,7 @@ describe('AlphaNav', () => {
it('hides Dashboard link and uses Home when unauthenticated', () => {
render(
<AuthProvider
value={{
session: null,
loading: false,
login: () => {},
logout: async () => {},
refreshSession: async () => {},
}}
initialSession={null}
>
<AlphaNav />
</AuthProvider>,
@@ -87,14 +81,11 @@ describe('AlphaNav', () => {
it('shows Dashboard link and hides Home when authenticated', () => {
render(
<AuthProvider
value={{
session: {
user: { id: 'user-1' },
},
loading: false,
login: () => {},
logout: async () => {},
refreshSession: async () => {},
initialSession={{
user: { id: 'user-1', displayName: 'Test User' },
issuedAt: Date.now(),
expiresAt: Date.now() + 3600000,
token: 'fake-token',
}}
>
<AlphaNav />