mirror of
https://github.com/lordmathis/lemma.git
synced 2025-11-05 15:44:21 +00:00
Add theme property to mock user in ProfileSettings tests
This commit is contained in:
@@ -4,6 +4,25 @@ import React from 'react';
|
|||||||
import { MantineProvider } from '@mantine/core';
|
import { MantineProvider } from '@mantine/core';
|
||||||
import ProfileSettings from './ProfileSettings';
|
import ProfileSettings from './ProfileSettings';
|
||||||
import type { UserProfileSettings } from '@/types/models';
|
import type { UserProfileSettings } from '@/types/models';
|
||||||
|
import { Theme, UserRole, type User } from '@/types/models';
|
||||||
|
|
||||||
|
// Mock user for AuthContext
|
||||||
|
const mockUser: User = {
|
||||||
|
id: 1,
|
||||||
|
email: 'test@example.com',
|
||||||
|
displayName: 'Test User',
|
||||||
|
role: UserRole.Editor,
|
||||||
|
theme: Theme.Dark,
|
||||||
|
createdAt: '2024-01-01T00:00:00Z',
|
||||||
|
lastWorkspaceId: 1,
|
||||||
|
};
|
||||||
|
|
||||||
|
// Mock the auth context
|
||||||
|
vi.mock('../../../contexts/AuthContext', () => ({
|
||||||
|
useAuth: () => ({
|
||||||
|
user: mockUser,
|
||||||
|
}),
|
||||||
|
}));
|
||||||
|
|
||||||
// Helper wrapper component for testing
|
// Helper wrapper component for testing
|
||||||
const TestWrapper = ({ children }: { children: React.ReactNode }) => (
|
const TestWrapper = ({ children }: { children: React.ReactNode }) => (
|
||||||
|
|||||||
@@ -188,6 +188,7 @@ describe('Models Type Guards', () => {
|
|||||||
id: 1,
|
id: 1,
|
||||||
email: 'test@example.com',
|
email: 'test@example.com',
|
||||||
role: UserRole.Editor,
|
role: UserRole.Editor,
|
||||||
|
theme: Theme.Dark,
|
||||||
createdAt: '2024-01-01T00:00:00Z',
|
createdAt: '2024-01-01T00:00:00Z',
|
||||||
lastWorkspaceId: 1,
|
lastWorkspaceId: 1,
|
||||||
__proto__: { malicious: true },
|
__proto__: { malicious: true },
|
||||||
@@ -773,6 +774,7 @@ describe('Models Type Guards', () => {
|
|||||||
id: 1,
|
id: 1,
|
||||||
email: 'test@example.com',
|
email: 'test@example.com',
|
||||||
role: UserRole.Editor,
|
role: UserRole.Editor,
|
||||||
|
theme: Theme.Dark,
|
||||||
createdAt: '2024-01-01T00:00:00Z',
|
createdAt: '2024-01-01T00:00:00Z',
|
||||||
lastWorkspaceId: 1,
|
lastWorkspaceId: 1,
|
||||||
};
|
};
|
||||||
@@ -806,6 +808,7 @@ describe('Models Type Guards', () => {
|
|||||||
id: 1,
|
id: 1,
|
||||||
email: 'test@example.com',
|
email: 'test@example.com',
|
||||||
role: UserRole.Editor,
|
role: UserRole.Editor,
|
||||||
|
theme: Theme.Dark,
|
||||||
createdAt: '2024-01-01T00:00:00Z',
|
createdAt: '2024-01-01T00:00:00Z',
|
||||||
lastWorkspaceId: 1,
|
lastWorkspaceId: 1,
|
||||||
});
|
});
|
||||||
@@ -854,6 +857,7 @@ describe('Models Type Guards', () => {
|
|||||||
id: 1,
|
id: 1,
|
||||||
email: longString,
|
email: longString,
|
||||||
role: UserRole.Editor,
|
role: UserRole.Editor,
|
||||||
|
theme: Theme.Dark,
|
||||||
createdAt: '2024-01-01T00:00:00Z',
|
createdAt: '2024-01-01T00:00:00Z',
|
||||||
lastWorkspaceId: 1,
|
lastWorkspaceId: 1,
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user