Skip to content

Commit 859bc3a

Browse files
author
Brian Chen
committed
don't track state for snapshots count
1 parent 2423169 commit 859bc3a

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1018,6 +1018,8 @@ abstract class TestRunner {
10181018
expect(this.snapshotsInSyncEvents).to.eq(
10191019
expectation.numSnapshotsInSyncEvents
10201020
);
1021+
// Reset count after checking so tests don't have to track state.
1022+
this.snapshotsInSyncEvents = 0;
10211023
}
10221024
}
10231025

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1470,7 +1470,7 @@ describeSpec('Writes:', [], () => {
14701470
.addSnapshotsInSyncListener()
14711471
.expectSnapshotsInSyncEventsCount(1)
14721472
.userSets('collection/a', { v: 2 })
1473-
.expectSnapshotsInSyncEventsCount(1);
1473+
.expectSnapshotsInSyncEventsCount(0);
14741474
}
14751475
);
14761476

@@ -1482,7 +1482,7 @@ describeSpec('Writes:', [], () => {
14821482
.addSnapshotsInSyncListener()
14831483
.expectSnapshotsInSyncEventsCount(1)
14841484
.addSnapshotsInSyncListener()
1485-
.expectSnapshotsInSyncEventsCount(2);
1485+
.expectSnapshotsInSyncEventsCount(1);
14861486
}
14871487
);
14881488

@@ -1508,19 +1508,19 @@ describeSpec('Writes:', [], () => {
15081508
hasPendingWrites: true,
15091509
modified: [docAv2Local]
15101510
})
1511-
.expectSnapshotsInSyncEventsCount(2)
1511+
.expectSnapshotsInSyncEventsCount(1)
15121512
.watchSends({ affects: [query] }, docAv2)
15131513
.watchSnapshots(2000)
15141514
.writeAcks('collection/a', 2000)
15151515
.expectEvents(query, {
15161516
metadata: [docAv2]
15171517
})
1518-
.expectSnapshotsInSyncEventsCount(3);
1518+
.expectSnapshotsInSyncEventsCount(1);
15191519
});
15201520

15211521
specTest(
15221522
'onSnapshotInSync fires once for multiple event snapshots',
1523-
['exclusive'],
1523+
[],
15241524
() => {
15251525
const query1 = Query.atPath(path('collection'));
15261526
const query2 = Query.atPath(path('collection/a'));
@@ -1552,7 +1552,7 @@ describeSpec('Writes:', [], () => {
15521552
hasPendingWrites: true,
15531553
modified: [docAv2Local]
15541554
})
1555-
.expectSnapshotsInSyncEventsCount(2)
1555+
.expectSnapshotsInSyncEventsCount(1)
15561556
.watchSends({ affects: [query1, query2] }, docAv2)
15571557
.watchSnapshots(2000)
15581558
.writeAcks('collection/a', 2000)
@@ -1562,7 +1562,7 @@ describeSpec('Writes:', [], () => {
15621562
.expectEvents(query2, {
15631563
metadata: [docAv2]
15641564
})
1565-
.expectSnapshotsInSyncEventsCount(3);
1565+
.expectSnapshotsInSyncEventsCount(1);
15661566
}
15671567
);
15681568

@@ -1603,22 +1603,22 @@ describeSpec('Writes:', [], () => {
16031603
.addSnapshotsInSyncListener()
16041604
.addSnapshotsInSyncListener()
16051605
// 2 original events + 2 new events from registering listeners.
1606-
.expectSnapshotsInSyncEventsCount(4)
1606+
.expectSnapshotsInSyncEventsCount(2)
16071607
.userSets('collection/a', { v: 3 })
16081608
.expectEvents(query, {
16091609
hasPendingWrites: true,
16101610
modified: [docAv3Local]
16111611
})
16121612
// 4 original events + 3 new events from the 3 listeners
1613-
.expectSnapshotsInSyncEventsCount(7)
1613+
.expectSnapshotsInSyncEventsCount(3)
16141614
.removeSnapshotsInSyncListener()
16151615
.userSets('collection/a', { v: 4 })
16161616
.expectEvents(query, {
16171617
hasPendingWrites: true,
16181618
modified: [docAv4Local]
16191619
})
16201620
// 7 original events + 2 new events from the 2 listeners
1621-
.expectSnapshotsInSyncEventsCount(9)
1621+
.expectSnapshotsInSyncEventsCount(2)
16221622
);
16231623
});
16241624
});

0 commit comments

Comments
 (0)