From 520f58435c912bb39eb8c2296297a2524ff80df7 Mon Sep 17 00:00:00 2001 From: LordMathis Date: Sun, 6 Jul 2025 01:32:02 +0200 Subject: [PATCH] Refactor tests to remove redundant settings mock data --- app/src/components/auth/LoginPage.test.tsx | 2 +- .../navigation/WorkspaceSwitcher.test.tsx | 2 -- .../workspace/DangerZoneSettings.test.tsx | 34 ------------------- .../workspace/WorkspaceSettings.test.tsx | 17 ---------- 4 files changed, 1 insertion(+), 54 deletions(-) diff --git a/app/src/components/auth/LoginPage.test.tsx b/app/src/components/auth/LoginPage.test.tsx index f7c4d78..02b3c47 100644 --- a/app/src/components/auth/LoginPage.test.tsx +++ b/app/src/components/auth/LoginPage.test.tsx @@ -238,7 +238,7 @@ describe('LoginPage', () => { }); it('handles special characters in credentials', async () => { - render(); + await render(); const specialEmail = 'user+test@example-domain.com'; const specialPassword = 'P@ssw0rd!#$%'; diff --git a/app/src/components/navigation/WorkspaceSwitcher.test.tsx b/app/src/components/navigation/WorkspaceSwitcher.test.tsx index 12516d2..00677f6 100644 --- a/app/src/components/navigation/WorkspaceSwitcher.test.tsx +++ b/app/src/components/navigation/WorkspaceSwitcher.test.tsx @@ -93,7 +93,6 @@ describe('WorkspaceSwitcher', () => { vi.mocked(useWorkspace).mockReturnValue({ currentWorkspace: mockCurrentWorkspace, workspaces: [], - settings: mockCurrentWorkspace, updateSettings: vi.fn(), loading: false, colorScheme: 'light', @@ -137,7 +136,6 @@ describe('WorkspaceSwitcher', () => { vi.mocked(useWorkspace).mockReturnValue({ currentWorkspace: null, workspaces: [], - settings: mockCurrentWorkspace, updateSettings: vi.fn(), loading: false, colorScheme: 'light', diff --git a/app/src/components/settings/workspace/DangerZoneSettings.test.tsx b/app/src/components/settings/workspace/DangerZoneSettings.test.tsx index 6439d61..75a5126 100644 --- a/app/src/components/settings/workspace/DangerZoneSettings.test.tsx +++ b/app/src/components/settings/workspace/DangerZoneSettings.test.tsx @@ -118,23 +118,6 @@ describe('DangerZoneSettings (Workspace)', () => { gitCommitEmail: '', }, ], - settings: { - id: 1, - userId: 1, - name: 'Test Workspace', - createdAt: '2024-01-01T00:00:00Z', - theme: Theme.Light, - autoSave: false, - showHiddenFiles: false, - gitEnabled: false, - gitUrl: '', - gitUser: '', - gitToken: '', - gitAutoCommit: false, - gitCommitMsgTemplate: '', - gitCommitName: '', - gitCommitEmail: '', - }, updateSettings: vi.fn(), loading: false, colorScheme: 'light', @@ -193,23 +176,6 @@ describe('DangerZoneSettings (Workspace)', () => { gitCommitEmail: '', }, ], - settings: { - id: 1, - userId: 1, - name: 'Last Workspace', - createdAt: '2024-01-01T00:00:00Z', - theme: Theme.Light, - autoSave: false, - showHiddenFiles: false, - gitEnabled: false, - gitUrl: '', - gitUser: '', - gitToken: '', - gitAutoCommit: false, - gitCommitMsgTemplate: '', - gitCommitName: '', - gitCommitEmail: '', - }, updateSettings: vi.fn(), loading: false, colorScheme: 'light', diff --git a/app/src/components/settings/workspace/WorkspaceSettings.test.tsx b/app/src/components/settings/workspace/WorkspaceSettings.test.tsx index a9603db..71b177a 100644 --- a/app/src/components/settings/workspace/WorkspaceSettings.test.tsx +++ b/app/src/components/settings/workspace/WorkspaceSettings.test.tsx @@ -102,23 +102,6 @@ describe('WorkspaceSettings', () => { gitCommitEmail: '', }, workspaces: [], - settings: { - id: 1, - userId: 1, - name: 'Test Workspace', - createdAt: '2024-01-01T00:00:00Z', - theme: Theme.Light, - autoSave: false, - showHiddenFiles: false, - gitEnabled: false, - gitUrl: '', - gitUser: '', - gitToken: '', - gitAutoCommit: false, - gitCommitMsgTemplate: '', - gitCommitName: '', - gitCommitEmail: '', - }, updateSettings: mockUpdateSettings, loading: false, colorScheme: 'light',