IndexedDbService

This commit is contained in:
Dominik Ziajka 2018-03-30 10:11:36 +02:00
parent 014cef0697
commit c87c8f12fb
2 changed files with 14 additions and 4 deletions

@ -9,7 +9,13 @@ describe('IndexedDbService', () => {
});
});
// it('should be created', inject([IndexedDbService], (service: IndexedDbService) => {
// expect(service).toBeTruthy();
// }));
it('should be created', inject([IndexedDbService], (service: IndexedDbService) => {
expect(service).toBeTruthy();
}));
it('should get AngularIndexedDB', inject([IndexedDbService], (service: IndexedDbService) => {
const indexeddb = service.get();
expect(indexeddb.dbWrapper.dbName).toEqual(IndexedDbService.DATABASE);
expect(indexeddb.dbWrapper.dbVersion).toEqual(IndexedDbService.VERSION);
}));
});

@ -3,10 +3,14 @@ import { AngularIndexedDB } from 'angular2-indexeddb';
@Injectable()
export class IndexedDbService {
static VERSION = 1;
static DATABASE = 'gns3-web-ui';
private db: AngularIndexedDB;
constructor() {
this.db = new AngularIndexedDB('gns3-web-ui', 1);
this.db = new AngularIndexedDB(
IndexedDbService.DATABASE, IndexedDbService.VERSION);
}
public get() {