From 4175b32bb964b9e3bb5740ce7aff3164da494128 Mon Sep 17 00:00:00 2001 From: jantoun-scottlogic Date: Tue, 6 Aug 2024 11:29:49 +0100 Subject: [PATCH] Use Map in MockStorageService --- .../carbon-estimator-form.component.spec.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/app/carbon-estimator-form/carbon-estimator-form.component.spec.ts b/src/app/carbon-estimator-form/carbon-estimator-form.component.spec.ts index 625d71b..4b68b1d 100644 --- a/src/app/carbon-estimator-form/carbon-estimator-form.component.spec.ts +++ b/src/app/carbon-estimator-form/carbon-estimator-form.component.spec.ts @@ -4,18 +4,18 @@ import { CarbonEstimatorFormComponent } from './carbon-estimator-form.component' import { StorageService } from '../services/storage.service'; class MockStorageService { - storage: Record = {}; + storage = new Map(); get(key: string): string | null { - return this.storage[key] || null; + return this.storage.get(key) || null; } set(key: string, value: string): void { - this.storage[key] = value; + this.storage.set(key, value); } removeItem(key: string): void { - delete this.storage[key]; + this.storage.delete(key); } }