From: Jérôme Benoit Date: Fri, 17 Apr 2026 10:02:47 +0000 (+0200) Subject: fix(ui-web): fix remaining for...in on localStorage and remove dead test config X-Git-Tag: cli@v4.5.0~39 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=14eeb8a121c39f965742c0e54effd2dae5f29f60;p=e-mobility-charging-stations-simulator.git 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) --- 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),