mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2025-06-17 06:18:09 +00:00
IndexedDbService
This commit is contained in:
@ -9,7 +9,13 @@ describe('IndexedDbService', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// it('should be created', inject([IndexedDbService], (service: IndexedDbService) => {
|
it('should be created', inject([IndexedDbService], (service: IndexedDbService) => {
|
||||||
// expect(service).toBeTruthy();
|
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()
|
@Injectable()
|
||||||
export class IndexedDbService {
|
export class IndexedDbService {
|
||||||
|
static VERSION = 1;
|
||||||
|
static DATABASE = 'gns3-web-ui';
|
||||||
|
|
||||||
private db: AngularIndexedDB;
|
private db: AngularIndexedDB;
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.db = new AngularIndexedDB('gns3-web-ui', 1);
|
this.db = new AngularIndexedDB(
|
||||||
|
IndexedDbService.DATABASE, IndexedDbService.VERSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
public get() {
|
public get() {
|
||||||
|
Reference in New Issue
Block a user