From 14eeb8a121c39f965742c0e54effd2dae5f29f60 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Fri, 17 Apr 2026 12:02:47 +0200 Subject: [PATCH] fix(ui-web): fix remaining for...in on localStorage and remove dead test config - Replace for...in with Object.keys() in deleteLocalStorageByKeyPattern - Remove dead $route/$router globalProperties from ChargingStationsView test (component now uses useRoute/useRouter composables via vi.mock) --- ui/web/src/composables/Utils.ts | 7 +------ ui/web/tests/unit/ChargingStationsView.test.ts | 6 ------ 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/ui/web/src/composables/Utils.ts b/ui/web/src/composables/Utils.ts index 17e0a649..623b209d 100644 --- a/ui/web/src/composables/Utils.ts +++ b/ui/web/src/composables/Utils.ts @@ -36,12 +36,7 @@ export const getLocalStorage = (): Storage => { * @param pattern - Substring to match against localStorage keys */ export const deleteLocalStorageByKeyPattern = (pattern: string): void => { - const keysToDelete: string[] = [] - for (const key in getLocalStorage()) { - if (key.includes(pattern)) { - keysToDelete.push(key) - } - } + const keysToDelete = Object.keys(localStorage).filter(key => key.includes(pattern)) for (const key of keysToDelete) { deleteFromLocalStorage(key) } diff --git a/ui/web/tests/unit/ChargingStationsView.test.ts b/ui/web/tests/unit/ChargingStationsView.test.ts index b4370ede..9ceda000 100644 --- a/ui/web/tests/unit/ChargingStationsView.test.ts +++ b/ui/web/tests/unit/ChargingStationsView.test.ts @@ -90,12 +90,6 @@ function mountView ( return mount(ChargingStationsView, { global: { - config: { - globalProperties: { - $route: { name: 'charging-stations', params: {}, query: {} }, - $router: { back: vi.fn(), push: vi.fn(), replace: vi.fn() }, - } as never, - }, provide: { [chargingStationsKey as symbol]: ref(chargingStations), [configurationKey as symbol]: ref(configuration), -- 2.53.0