This commit is contained in:
Ivan Socolsky 2017-08-07 17:21:25 -03:00
parent 24cd875ca7
commit 3649d5c54a
No known key found for this signature in database
GPG Key ID: FAECE6A05FAA4F56
1 changed files with 10 additions and 1 deletions

View File

@ -1,6 +1,6 @@
import { TestBed, inject } from '@angular/core/testing';
import { PersistenceProvider } from './persistence';
import { IStorage, ISTORAGE } from './storage/istorage';
import { IStorage, ISTORAGE, KeyAlreadyExistsError } from './storage/istorage';
import { RamStorage } from './storage/ram-storage';
describe('Storage Service', () => {
@ -26,5 +26,14 @@ describe('Storage Service', () => {
});
});
}));
it('should fail to create a profile when one already exists', inject([PersistenceProvider], (service: PersistenceProvider) => {
var p = { name: 'My profile' };
service.storeNewProfile(p, (err) => {
expect(err).toBeNull;
service.storeNewProfile(p, (err) => {
expect(err.message).toEqual('Key already exists');
});
});
}));
});
});