import { inject , TestBed } from '@angular/core/testing' ; import { LocalStorageProvider } from '../core/nativeStorage' ; import { LocalStorageService , LocalStorageServiceProvider } from './localStorage' ; import { StorageStrategies } from '../constants/strategy' ; import { LocalStorageStrategy } from '../strategies/localStorage' ; import { STORAGE_STRATEGIES } from '../strategies' ; import { StrategyIndex } from './strategyIndex' ; describe ( 'Services : LocalStorageService' , ( ) => { beforeEach ( ( ) => { TestBed . configureTestingModule ( { providers : [ LocalStorageProvider , { provide : STORAGE_STRATEGIES , useClass : LocalStorageStrategy , multi : true } , LocalStorageServiceProvider ] } ) ; } ) ; beforeEach ( inject ( [ StrategyIndex ] , ( index ) => { index . indexStrategies ( ) ; } ) ) ; afterEach ( ( ) => { StrategyIndex . clear ( ) ; } ) ; it ( 'should provide the localStorageService' , inject ( [ LocalStorageService ] , ( storage ) => { expect ( storage ) . toBeDefined ( ) ; expect ( storage . getStrategyName ( ) ) . toEqual ( StorageStrategies . Local ) ; } ) ) ; } ) ;