Skip to content

Commit c5c558d

Browse files
committed
resolve comments
1 parent d415d4d commit c5c558d

File tree

2 files changed

+22
-25
lines changed

2 files changed

+22
-25
lines changed

packages/firestore/test/integration/api/snasphot_listener_source.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -671,14 +671,14 @@ apiDescribe('Snapshot Listener source options ', persistence => {
671671
return withTestCollection(persistence, testDocs, async coll => {
672672
await getDocs(coll); // Populate the cache.
673673

674-
const query_ = query(
674+
const testQuery = query(
675675
coll,
676676
where('k', '<=', 'a'),
677677
where('sort', '>=', 0)
678678
);
679679
const storeEvent = new EventsAccumulator<QuerySnapshot>();
680680
const unsubscribe = onSnapshot(
681-
query_,
681+
testQuery,
682682
{ source: ListenSource.Cache },
683683
storeEvent.storeEvent
684684
);

packages/firestore/test/unit/specs/listen_source_spec.test.ts

Lines changed: 20 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*/
1717

1818
import { LimitType, queryWithLimit } from '../../../src/core/query';
19-
import { deletedDoc, doc, filter, orderBy, query } from '../../util/helpers';
19+
import { doc, filter, orderBy, query } from '../../util/helpers';
2020

2121
import { bundleWithDocumentAndQuery } from './bundle_spec.test';
2222
import { describeSpec, specTest } from './describe_spec';
@@ -28,30 +28,29 @@ describeSpec('Listens source options:', [], () => {
2828
['eager-gc'],
2929
'Explicitly tests eager GC behavior',
3030
() => {
31-
const query_ = query('collection');
31+
const testQuery = query('collection');
3232
const docA = doc('collection/a', 0, { key: 'a' }).setHasLocalMutations();
3333
return (
3434
spec()
3535
.userSets('collection/a', { key: 'a' })
36-
.userListensToCache(query_)
37-
.expectEvents(query_, {
36+
.userListensToCache(testQuery)
37+
.expectEvents(testQuery, {
3838
added: [docA],
3939
hasPendingWrites: true,
4040
fromCache: true
4141
})
42-
.userUnlistensToCache(query_)
42+
.userUnlistensToCache(testQuery)
4343
.writeAcks('collection/a', 1000)
4444
// Cache is empty as docA is GCed.
45-
.userListensToCache(query_)
46-
.expectEvents(query_, { added: [], fromCache: true })
45+
.userListensToCache(testQuery)
46+
.expectEvents(testQuery, { added: [], fromCache: true })
4747
);
4848
}
4949
);
5050

5151
specTest(
5252
'Documents are cleared when listen is removed.',
5353
['eager-gc'],
54-
'',
5554
() => {
5655
const filteredQuery = query('collection', filter('matches', '==', true));
5756
const unfilteredQuery = query('collection');
@@ -91,42 +90,40 @@ describeSpec('Listens source options:', [], () => {
9190
);
9291

9392
specTest("Doesn't include unknown documents in cached result", [], () => {
94-
const query_ = query('collection');
93+
const testQuery = query('collection');
9594
const existingDoc = doc('collection/exists', 0, {
9695
key: 'a'
9796
}).setHasLocalMutations();
9897
return spec()
9998
.userSets('collection/exists', { key: 'a' })
10099
.userPatches('collection/unknown', { key: 'b' })
101-
.userListensToCache(query_)
102-
.expectEvents(query_, {
100+
.userListensToCache(testQuery)
101+
.expectEvents(testQuery, {
103102
added: [existingDoc],
104103
fromCache: true,
105104
hasPendingWrites: true
106105
});
107106
});
108107

109108
specTest("Doesn't raise 'hasPendingWrites' for deletes", [], () => {
110-
const query_ = query('collection');
109+
const testQuery = query('collection');
111110
const docA = doc('collection/a', 1000, { key: 'a' });
112111

113112
return (
114113
spec()
115114
.ensureManualLruGC()
116115
// Populate the cache first
117-
.userListens(query_)
118-
.watchAcksFull(query_, 1000, docA)
119-
.expectEvents(query_, { added: [docA] })
120-
.userUnlistens(query_)
121-
.watchRemoves(query_)
116+
.userListens(testQuery)
117+
.watchAcksFull(testQuery, 1000, docA)
118+
.expectEvents(testQuery, { added: [docA] })
119+
.userUnlistens(testQuery)
120+
.watchRemoves(testQuery)
122121
// Listen to cache
123-
.userListensToCache(query_)
124-
.expectEvents(query_, { added: [docA], fromCache: true })
122+
.userListensToCache(testQuery)
123+
.expectEvents(testQuery, { added: [docA], fromCache: true })
125124
.userDeletes('collection/a')
126-
.expectEvents(query_, { removed: [docA], fromCache: true })
125+
.expectEvents(testQuery, { removed: [docA], fromCache: true })
127126
.writeAcks('collection/a', 2000)
128-
.watchSends({ affects: [query_] }, deletedDoc('collection/a', 2000))
129-
.watchSnapshots(2000)
130127
);
131128
});
132129

@@ -554,7 +551,7 @@ describeSpec('Listens source options:', [], () => {
554551
);
555552

556553
specTest(
557-
'Query is executed by primary client even if it only includes listeners sourced from cache',
554+
'Query is executed by primary client even if primary client only has listeners sourced from cache',
558555
['multi-client'],
559556
() => {
560557
const query1 = query('collection');

0 commit comments

Comments
 (0)