From 8def94291747b97e51101a4f122bc53cf772faf1 Mon Sep 17 00:00:00 2001 From: Gandalf the Greybeard Date: Tue, 17 Mar 2026 00:39:56 +0000 Subject: [PATCH] fix: use Object.defineProperty for window.location in test Replace `as Location` cast with Object.defineProperty to match the existing beforeEach pattern and fix TypeScript strict mode error. Co-Authored-By: Paperclip --- src/components/AppBarScoreBadge.test.tsx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/AppBarScoreBadge.test.tsx b/src/components/AppBarScoreBadge.test.tsx index daca7a0..dd55067 100644 --- a/src/components/AppBarScoreBadge.test.tsx +++ b/src/components/AppBarScoreBadge.test.tsx @@ -124,7 +124,10 @@ describe('AppBarScoreBadge', () => { }); it('navigates to /polaris when no cluster in URL', async () => { - window.location = { pathname: '/settings' } as Location; + Object.defineProperty(window, 'location', { + value: { pathname: '/settings' }, + writable: true, + }); const user = userEvent.setup(); const data = makeAuditData([ makeResult({