Skip to content

Commit 91b2927

Browse files
Harden callback asserts
1 parent 1697e62 commit 91b2927

File tree

3 files changed

+14
-10
lines changed

3 files changed

+14
-10
lines changed

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,11 @@ describeSpec('Persistence:', ['persistence'], () => {
117117
.userSets('users/user1', { uid: 'user1', extra: true })
118118
.changeUser(null)
119119
.expectNumOutstandingWrites(1)
120-
.writeAcks('users/anon', 1000, { expectUserCallback: false })
120+
.writeAcks('users/anon', 1000)
121121
.changeUser('user1')
122122
.expectNumOutstandingWrites(2)
123-
.writeAcks('users/user1', 2000, { expectUserCallback: false })
124-
.writeAcks('users/user1', 3000, { expectUserCallback: false });
123+
.writeAcks('users/user1', 2000)
124+
.writeAcks('users/user1', 3000);
125125
});
126126

127127
specTest(

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

+10-6
Original file line numberDiff line numberDiff line change
@@ -947,14 +947,18 @@ abstract class TestRunner {
947947
if ('isPrimary' in expectation) {
948948
expect(this.isPrimaryClient).to.eq(expectation.isPrimary!, 'isPrimary');
949949
}
950-
if ('userCallbacks' in expectation) {
951-
expect(this.acknowledgedDocs).to.have.members(
950+
}
951+
952+
if (expectation && expectation.userCallbacks) {
953+
expect(this.acknowledgedDocs).to.have.members(
952954
expectation.userCallbacks.acknowledgedDocs
953-
);
954-
expect(this.rejectedDocs).to.have.members(
955+
);
956+
expect(this.rejectedDocs).to.have.members(
955957
expectation.userCallbacks.rejectedDocs
956-
);
957-
}
958+
);
959+
} else {
960+
expect(this.acknowledgedDocs).to.be.empty;
961+
expect(this.rejectedDocs).to.be.empty;
958962
}
959963

960964
if (this.numClients === 1) {

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

+1-1
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,7 @@ describeSpec('Writes:', [], () => {
645645
expectRequestCount({ handshakes: 2, writes: 2, closes: 1 })
646646
)
647647
.expectNumOutstandingWrites(1)
648-
.writeAcks('collection/key', 1, { expectUserCallback: false })
648+
.writeAcks('collection/key', 1)
649649
.expectNumOutstandingWrites(0);
650650
});
651651

0 commit comments

Comments
 (0)