refactor: move web http client to a new file

This commit is contained in:
Jovan Krunić
2018-12-14 10:52:52 +01:00
parent 83a2c85e05
commit 246dddd5a5
5 changed files with 79 additions and 62 deletions

View File

@@ -48,8 +48,8 @@ describe('StorageProvider', () => {
it('should call set method of storage to put a value', () => {
spyOn(storage, 'set');
storageProvider.put('some-uid', { some: 'thing' });
expect(storage.set).toHaveBeenCalledWith('some-uid', { some: 'thing' });
storageProvider.put('some-uid', {some: 'thing'});
expect(storage.set).toHaveBeenCalledWith('some-uid', {some: 'thing'});
});
it('should call get method of storage to get a value', () => {
@@ -99,7 +99,7 @@ describe('StorageProvider', () => {
spyOn(storageProvider, 'get').and.callThrough();
await storageProvider.putMultiple(sampleEntries);
const entries = await storageProvider.getAll();
expect(Array.from(entries.values()).map((item) => (item.foo) ? item.foo : item).sort())
expect(Array.from(entries.values()).map((item) => (item.foo) ? item.foo : item).sort())
.toEqual(Array.from(sampleEntries.values()).map((item) => (item.foo) ? item.foo : item).sort());
expect(Array.from(entries.keys()).sort()).toEqual(['bar', 'foo', 'foobar']);
});