From f0120d121fc8c374eaeff8b3141d94cfbd60ea04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Can=20Y=C4=B1lmaz?= <30300440+bariscanyilmaz@users.noreply.github.com> Date: Wed, 8 Mar 2023 18:12:51 +0300 Subject: [PATCH] implement primitive tests --- .../lib/tests/local-storage.service.spec.ts | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/npm/ng-packs/packages/core/src/lib/tests/local-storage.service.spec.ts b/npm/ng-packs/packages/core/src/lib/tests/local-storage.service.spec.ts index 204c052d21..ad51bbda2b 100644 --- a/npm/ng-packs/packages/core/src/lib/tests/local-storage.service.spec.ts +++ b/npm/ng-packs/packages/core/src/lib/tests/local-storage.service.spec.ts @@ -13,4 +13,40 @@ describe('LocalStorageService', () => { it('should be created', () => { expect(service).toBeTruthy(); }); + + it('should be called getItem', () => { + const spy = jest.spyOn(service, 'getItem'); + service.getItem('test'); + expect(spy).toHaveBeenCalled(); + }); + + it('should be called setItem', () => { + const spy = jest.spyOn(service, 'setItem'); + service.setItem('test', 'value'); + expect(spy).toHaveBeenCalled(); + }); + + it('should be called removeItem', () => { + const spy = jest.spyOn(service, 'removeItem'); + service.removeItem('test'); + expect(spy).toHaveBeenCalled(); + }); + + it('should be called clear', () => { + const spy = jest.spyOn(service, 'clear'); + service.clear(); + expect(spy).toHaveBeenCalled(); + }); + + it('should be called key', () => { + const spy = jest.spyOn(service, 'key'); + service.key(0); + expect(spy).toHaveBeenCalled(); + }); + + it('should be called length', () => { + const spy = jest.spyOn(service, 'length', 'get'); + service.length; + expect(spy).toHaveBeenCalled(); + }); });