]> Piment Noir Git Repositories - e-mobility-charging-stations-simulator.git/commitdiff
fix(ui-web): fix remaining for...in on localStorage and remove dead test config
authorJérôme Benoit <jerome.benoit@sap.com>
Fri, 17 Apr 2026 10:02:47 +0000 (12:02 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Fri, 17 Apr 2026 10:02:47 +0000 (12:02 +0200)
- 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
ui/web/tests/unit/ChargingStationsView.test.ts

index 17e0a649e1586a31e669bff2b3f70af23d7e05c3..623b209df1b09a4661969c204707ffb2969b9ce2 100644 (file)
@@ -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)
   }
index b4370ede7c09e1afc11c86b2c37e532f70f67840..9ceda00033d90ab4769c626d5af467ef64f04153 100644 (file)
@@ -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),