Skip to content

Commit c120983

Browse files
committed
undo not required changes
1 parent f174fca commit c120983

File tree

3 files changed

+12
-24
lines changed

3 files changed

+12
-24
lines changed

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

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -202,10 +202,7 @@ apiDescribe('Bundles', persistence => {
202202
await setDoc(doc(db, 'coll-1/b'), { k: 'b', bar: 0 });
203203

204204
const accumulator = new EventsAccumulator<QuerySnapshot>();
205-
const unsubscribe = onSnapshot(
206-
collection(db, 'coll-1'),
207-
accumulator.storeEvent
208-
);
205+
onSnapshot(collection(db, 'coll-1'), accumulator.storeEvent);
209206
await accumulator.awaitEvent();
210207

211208
const progress = await loadBundle(
@@ -219,7 +216,6 @@ apiDescribe('Bundles', persistence => {
219216
// generated as a result. The case where a bundle has newer doc than
220217
// cache can only be tested in spec tests.
221218
await accumulator.assertNoAdditionalEvents();
222-
unsubscribe();
223219

224220
let snap = await getDocs((await namedQuery(db, 'limit'))!);
225221
expect(toDataArray(snap)).to.deep.equal([{ k: 'b', bar: 0 }]);

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

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -840,15 +840,15 @@ apiDescribe('Database', persistence => {
840840
const gotInitialSnapshot = new Deferred<void>();
841841
const docA = doc(coll, 'a');
842842

843-
const unsubscribe1 = onSnapshot(docA, snap => {
843+
onSnapshot(docA, snap => {
844844
events.push('doc');
845845
gotInitialSnapshot.resolve();
846846
});
847847
await gotInitialSnapshot.promise;
848848
events = [];
849849

850850
const done = new Deferred<void>();
851-
const unsubscribe2 = onSnapshotsInSync(db, () => {
851+
onSnapshotsInSync(db, () => {
852852
events.push('snapshots-in-sync');
853853
if (events.length === 3) {
854854
// We should have an initial snapshots-in-sync event, then a snapshot
@@ -865,8 +865,6 @@ apiDescribe('Database', persistence => {
865865

866866
await setDoc(docA, { foo: 3 });
867867
await done.promise;
868-
unsubscribe1();
869-
unsubscribe2();
870868
});
871869
});
872870

@@ -1087,29 +1085,24 @@ apiDescribe('Database', persistence => {
10871085
});
10881086

10891087
it('DocumentSnapshot events for nonexistent document', () => {
1090-
return withTestCollection(persistence, {}, async col => {
1088+
return withTestCollection(persistence, {}, col => {
10911089
const docA = doc(col);
10921090
const storeEvent = new EventsAccumulator<DocumentSnapshot>();
1093-
const unsubscribe = onSnapshot(docA, storeEvent.storeEvent);
1094-
await storeEvent.awaitEvent().then(snap => {
1091+
onSnapshot(docA, storeEvent.storeEvent);
1092+
return storeEvent.awaitEvent().then(snap => {
10951093
expect(snap.exists()).to.be.false;
10961094
expect(snap.data()).to.equal(undefined);
1095+
return storeEvent.assertNoAdditionalEvents();
10971096
});
1098-
await storeEvent.assertNoAdditionalEvents();
1099-
unsubscribe();
11001097
});
11011098
});
11021099

11031100
it('DocumentSnapshot events for add data to document', () => {
1104-
return withTestCollection(persistence, {}, async col => {
1101+
return withTestCollection(persistence, {}, col => {
11051102
const docA = doc(col);
11061103
const storeEvent = new EventsAccumulator<DocumentSnapshot>();
1107-
const unsubscribe = onSnapshot(
1108-
docA,
1109-
{ includeMetadataChanges: true },
1110-
storeEvent.storeEvent
1111-
);
1112-
await storeEvent
1104+
onSnapshot(docA, { includeMetadataChanges: true }, storeEvent.storeEvent);
1105+
return storeEvent
11131106
.awaitEvent()
11141107
.then(snap => {
11151108
expect(snap.exists()).to.be.false;
@@ -1131,7 +1124,6 @@ apiDescribe('Database', persistence => {
11311124
// TODO(b/295872012): Figure out a way to check for all scenarios.
11321125
// expect(snap.metadata.hasPendingWrites).to.be.false;
11331126
});
1134-
unsubscribe();
11351127
});
11361128
});
11371129

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,8 @@ apiDescribe('Validation:', persistence => {
234234
validationIt(
235235
persistence,
236236
'disallows calling enableIndexedDbPersistence() after use',
237-
async db => {
238-
await getDoc(doc(db, 'foo/bar'));
237+
db => {
238+
//doc(db, 'foo/bar');
239239
expect(() => enableIndexedDbPersistence(db)).to.throw(
240240
'Firestore has already been started and persistence can no ' +
241241
'longer be enabled. You can only enable persistence before ' +

0 commit comments

Comments
 (0)