diff --git a/src/core/datastore/cachestore.spec.js b/src/core/datastore/cachestore.spec.js index 81967a643..effbf3094 100644 --- a/src/core/datastore/cachestore.spec.js +++ b/src/core/datastore/cachestore.spec.js @@ -397,28 +397,6 @@ describe('CacheStore', () => { }); }); - it('should throw an error if there are entities to sync', (done) => { - const entity = { _id: randomString() }; - const syncStore = new SyncStore(collection); - syncStore.save(entity) - .then(() => { - const aggregation = new Aggregation(); - const store = new CacheStore(collection); - store.group(aggregation) - .subscribe(null, (error) => { - try { - expect(error).toBeA(KinveyError); - expect(error.message).toInclude(pendingPushEntitiesErrMsg); - done(); - } catch (e) { - done(e); - } - }, () => { - done(new Error('This test should fail.')); - }); - }); - }); - it('should return the count of all unique properties on the collection', (done) => { const entity1 = { _id: randomString(), title: randomString() }; const entity2 = { _id: randomString(), title: randomString() }; @@ -489,27 +467,6 @@ describe('CacheStore', () => { }); }); - it('should throw an error if there are entities to sync', (done) => { - const entity = { _id: randomString() }; - const syncStore = new SyncStore(collection); - syncStore.save(entity) - .then(() => { - const store = new CacheStore(collection); - store.count() - .subscribe(null, (error) => { - try { - expect(error).toBeA(KinveyError); - expect(error.message).toInclude(pendingPushEntitiesErrMsg); - done(); - } catch (e) { - done(e); - } - }, () => { - done(new Error('This test should fail.')); - }); - }); - }); - it('should return the count for the collection', (done) => { const entity1 = { _id: randomString() }; const entity2 = { _id: randomString() }; diff --git a/src/core/datastore/processors/cache-offline-data-processor.js b/src/core/datastore/processors/cache-offline-data-processor.js index 87cfa8bcf..3e834cd58 100644 --- a/src/core/datastore/processors/cache-offline-data-processor.js +++ b/src/core/datastore/processors/cache-offline-data-processor.js @@ -128,12 +128,9 @@ export class CacheOfflineDataProcessor extends OfflineDataProcessor { return super._processCount(collection, query, options) .then((offlineCount) => { observer.next(offlineCount); - return this._ensureCountBeforeRead(collection, 'count entities', query); + return this._networkRepository.count(collection, query, options); }) - .then(() => this._networkRepository.count(collection, query, options)) - .then((networkCount) => { - observer.next(networkCount); - }); + .then(networkCount => observer.next(networkCount)); }); } @@ -143,9 +140,8 @@ export class CacheOfflineDataProcessor extends OfflineDataProcessor { .catch(() => []) // backwards compatibility .then((offlineResult) => { observer.next(offlineResult); - return this._ensureCountBeforeRead(collection, 'group entities'); + return this._networkRepository.group(collection, aggregationQuery, options); }) - .then(() => this._networkRepository.group(collection, aggregationQuery, options)) .then(networkResult => observer.next(networkResult)); }); } diff --git a/src/core/datastore/working-with-data-tests/cache-offline-data-processor.spec.js b/src/core/datastore/working-with-data-tests/cache-offline-data-processor.spec.js index e0748b2da..f07576481 100644 --- a/src/core/datastore/working-with-data-tests/cache-offline-data-processor.spec.js +++ b/src/core/datastore/working-with-data-tests/cache-offline-data-processor.spec.js @@ -208,8 +208,6 @@ describe('CacheOfflineDataProcessor', () => { expect(result).toBeA(KinveyObservable); }); - addSyncQueueTests(); - it('should call OfflineRepo.count()', () => { return dataProcessor.process(operation, options).toPromise() .then(() => { @@ -242,8 +240,6 @@ describe('CacheOfflineDataProcessor', () => { }); }); - addSyncQueueTests(); - it('should call NetworkRepo.group()', () => { return dataProcessor.process(operation, options).toPromise() .then(() => {