From bbdabefd62695805f82f771b7fb4b317caa6e4a9 Mon Sep 17 00:00:00 2001 From: Ryan Kegel Date: Thu, 19 Feb 2026 14:59:28 -0500 Subject: [PATCH] fixed frontent test errors --- .../vue-app/src/stores/__tests__/auth.childmode.spec.ts | 7 ++++++- frontend/vue-app/src/test/setup.ts | 7 ------- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/frontend/vue-app/src/stores/__tests__/auth.childmode.spec.ts b/frontend/vue-app/src/stores/__tests__/auth.childmode.spec.ts index ef56a56..7ad1b6d 100644 --- a/frontend/vue-app/src/stores/__tests__/auth.childmode.spec.ts +++ b/frontend/vue-app/src/stores/__tests__/auth.childmode.spec.ts @@ -1,7 +1,12 @@ -import { describe, it, expect, vi, beforeEach } from 'vitest' +import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest' import { isParentAuthenticated, isUserLoggedIn, loginUser, initAuthSync } from '../auth' import { nextTick } from 'vue' +// Stub window.location to prevent jsdom "navigation to another Document" warnings +// triggered when the auth store sets window.location.href on logout. +const locationStub = { href: '', pathname: '/', assign: vi.fn(), replace: vi.fn(), reload: vi.fn() } +Object.defineProperty(window, 'location', { value: locationStub, writable: true }) + // Helper to mock localStorage global.localStorage = { store: {} as Record, diff --git a/frontend/vue-app/src/test/setup.ts b/frontend/vue-app/src/test/setup.ts index 1f84105..7867d8b 100644 --- a/frontend/vue-app/src/test/setup.ts +++ b/frontend/vue-app/src/test/setup.ts @@ -3,13 +3,6 @@ import { vi } from 'vitest' // jsdom does not implement scrollTo — stub it to suppress "Not implemented" warnings window.scrollTo = vi.fn() -// jsdom does not support navigation — stub window.location to suppress -// "Not implemented: navigation to another Document" warnings -Object.defineProperty(window, 'location', { - value: { href: '', pathname: '/', assign: vi.fn(), replace: vi.fn(), reload: vi.fn() }, - writable: true, -}) - // Globally mock imageCache so component tests don't make real fetch calls // and don't spam "response.blob is not a function" errors in jsdom. vi.mock('@/common/imageCache', () => ({