feat: init
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
import { TestBed } from '@/testing';
|
||||
import { vi } from 'vitest';
|
||||
import { DefaultLocalStorageService } from './default-localstorage.service';
|
||||
|
||||
describe('DefaultLocalStorageService', () => {
|
||||
@@ -20,37 +21,37 @@ describe('DefaultLocalStorageService', () => {
|
||||
|
||||
describe('read', () => {
|
||||
it('should call localstorage.getItem', () => {
|
||||
const spy = spyOn(localStorage, 'getItem');
|
||||
const spy = vi.spyOn(localStorage, 'getItem');
|
||||
|
||||
service.read('henlo');
|
||||
|
||||
expect(spy).toHaveBeenCalledOnceWith('henlo');
|
||||
expect(spy).toHaveBeenCalledExactlyOnceWith('henlo');
|
||||
});
|
||||
});
|
||||
|
||||
describe('write', () => {
|
||||
it('should call localstorage.setItem', () => {
|
||||
const spy = spyOn(localStorage, 'setItem');
|
||||
const spy = vi.spyOn(localStorage, 'setItem');
|
||||
|
||||
service.write('henlo', 'furiend');
|
||||
|
||||
expect(spy).toHaveBeenCalledOnceWith('henlo', 'furiend');
|
||||
expect(spy).toHaveBeenCalledExactlyOnceWith('henlo', 'furiend');
|
||||
});
|
||||
});
|
||||
|
||||
describe('remove', () => {
|
||||
it('should call localstorage.removeItem', () => {
|
||||
const spy = spyOn(localStorage, 'removeItem');
|
||||
const spy = vi.spyOn(localStorage, 'removeItem');
|
||||
|
||||
service.remove('henlo');
|
||||
|
||||
expect(spy).toHaveBeenCalledOnceWith('henlo');
|
||||
expect(spy).toHaveBeenCalledExactlyOnceWith('henlo');
|
||||
});
|
||||
});
|
||||
|
||||
describe('clear', () => {
|
||||
it('should call localstorage.clear', () => {
|
||||
const spy = spyOn(localStorage, 'clear');
|
||||
const spy = vi.spyOn(localStorage, 'clear');
|
||||
|
||||
service.clear();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user