feat: init and fork some code from angular-auth-oidc-client
Some checks are pending
Build, Lint & Test Lib / Built, Lint and Test Library (push) Waiting to run
Build, Lint & Test Lib / Angular latest (push) Blocked by required conditions
Build, Lint & Test Lib / Angular latest & Schematics Job (push) Blocked by required conditions
Build, Lint & Test Lib / Angular latest Standalone & Schematics Job (push) Blocked by required conditions
Build, Lint & Test Lib / Angular 16 & RxJs 6 (push) Blocked by required conditions
Build, Lint & Test Lib / Angular V16 (push) Blocked by required conditions
Docs / Build and Deploy Docs Job (push) Waiting to run
Docs / Close Pull Request Job (push) Waiting to run
Some checks are pending
Build, Lint & Test Lib / Built, Lint and Test Library (push) Waiting to run
Build, Lint & Test Lib / Angular latest (push) Blocked by required conditions
Build, Lint & Test Lib / Angular latest & Schematics Job (push) Blocked by required conditions
Build, Lint & Test Lib / Angular latest Standalone & Schematics Job (push) Blocked by required conditions
Build, Lint & Test Lib / Angular 16 & RxJs 6 (push) Blocked by required conditions
Build, Lint & Test Lib / Angular V16 (push) Blocked by required conditions
Docs / Build and Deploy Docs Job (push) Waiting to run
Docs / Close Pull Request Job (push) Waiting to run
This commit is contained in:
60
src/storage/default-localstorage.service.spec.ts
Normal file
60
src/storage/default-localstorage.service.spec.ts
Normal file
@@ -0,0 +1,60 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { DefaultLocalStorageService } from './default-localstorage.service';
|
||||
|
||||
describe('DefaultLocalStorageService', () => {
|
||||
let service: DefaultLocalStorageService;
|
||||
|
||||
beforeEach(() => {
|
||||
TestBed.configureTestingModule({
|
||||
providers: [DefaultLocalStorageService],
|
||||
});
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
service = TestBed.inject(DefaultLocalStorageService);
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(service).toBeTruthy();
|
||||
});
|
||||
|
||||
describe('read', () => {
|
||||
it('should call localstorage.getItem', () => {
|
||||
const spy = spyOn(localStorage, 'getItem');
|
||||
|
||||
service.read('henlo');
|
||||
|
||||
expect(spy).toHaveBeenCalledOnceWith('henlo');
|
||||
});
|
||||
});
|
||||
|
||||
describe('write', () => {
|
||||
it('should call localstorage.setItem', () => {
|
||||
const spy = spyOn(localStorage, 'setItem');
|
||||
|
||||
service.write('henlo', 'furiend');
|
||||
|
||||
expect(spy).toHaveBeenCalledOnceWith('henlo', 'furiend');
|
||||
});
|
||||
});
|
||||
|
||||
describe('remove', () => {
|
||||
it('should call localstorage.removeItem', () => {
|
||||
const spy = spyOn(localStorage, 'removeItem');
|
||||
|
||||
service.remove('henlo');
|
||||
|
||||
expect(spy).toHaveBeenCalledOnceWith('henlo');
|
||||
});
|
||||
});
|
||||
|
||||
describe('clear', () => {
|
||||
it('should call localstorage.clear', () => {
|
||||
const spy = spyOn(localStorage, 'clear');
|
||||
|
||||
service.clear();
|
||||
|
||||
expect(spy).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user