diff --git a/projects/ngneat/cashew/src/lib/specs/local-storage.spec.ts b/projects/ngneat/cashew/src/lib/specs/local-storage.spec.ts index 871759b..3e1b568 100644 --- a/projects/ngneat/cashew/src/lib/specs/local-storage.spec.ts +++ b/projects/ngneat/cashew/src/lib/specs/local-storage.spec.ts @@ -1,5 +1,6 @@ import { httpResponse, localStorageMock } from './mocks'; import { HttpCacheLocalStorage } from '../local-storage/local-storage-cache'; +import { HttpHeaders, HttpResponse } from '@angular/common/http'; describe('httpCacheLocalStorage', () => { let storage: HttpCacheLocalStorage; @@ -28,6 +29,12 @@ describe('httpCacheLocalStorage', () => { expect(storage.get(existingKey)).toBe(response); }); + it('should get the cached response headers', () => { + const { headers } = storage.get(existingKey) as HttpResponse; + expect(headers).toBeInstanceOf(HttpHeaders); + expect(headers).toBe(response.headers); + }); + it('should not access local storage when key is found in memory', () => { jest.spyOn(localStorage, 'setItem'); const value = storage.get(existingKey);