Skip to content

Commit 33004ed

Browse files
committed
chore: fix test logic
1 parent 33d96fa commit 33004ed

File tree

1 file changed

+12
-28
lines changed

1 file changed

+12
-28
lines changed

packages/firestore/e2e/firestore.e2e.js

Lines changed: 12 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -921,19 +921,14 @@ describe('firestore()', function () {
921921

922922
it('snapshotsInSync fires', async function () {
923923
if (Platform.other) {
924+
// Should throw error for lite SDK
924925
try {
925-
const testDoc = doc(getFirestore(), `${COLLECTION}/snapshotsInSync`);
926-
927-
const promise = new Promise(resolve => {
928-
const unsubscribe = onSnapshotsInSync(getFirestore(), () => {
929-
events.push('onSnapshotsInSync');
930-
unsubscribe();
931-
resolve();
932-
});
933-
});
926+
const unsubscribe = onSnapshotsInSync(getFirestore(), () => {});
927+
unsubscribe();
934928
} catch (e) {
935-
e.message.should.containEql('Not supported in the lite SDK');
929+
e.message.should.equal('Not supported in the lite SDK.');
936930
}
931+
return;
937932
}
938933

939934
const events = [];
@@ -958,19 +953,14 @@ describe('firestore()', function () {
958953

959954
it('handles multiple writes and unsubscribe correctly', async function () {
960955
if (Platform.other) {
956+
// Should throw error for lite SDK
961957
try {
962-
const testDoc = doc(getFirestore(), `${COLLECTION}/snapshotsInSync`);
963-
964-
const promise = new Promise(resolve => {
965-
const unsubscribe = onSnapshotsInSync(getFirestore(), () => {
966-
events.push('onSnapshotsInSync');
967-
unsubscribe();
968-
resolve();
969-
});
970-
});
958+
const unsubscribe = onSnapshotsInSync(getFirestore(), () => {});
959+
unsubscribe();
971960
} catch (e) {
972-
e.message.should.containEql('Not supported in the lite SDK');
961+
e.message.should.equal('Not supported in the lite SDK.');
973962
}
963+
return;
974964
}
975965

976966
const events = [];
@@ -988,21 +978,15 @@ describe('firestore()', function () {
988978
});
989979
});
990980

991-
await Promise.all([
992-
setDoc(testDoc1, { test: 1 }),
993-
setDoc(testDoc2, { test: 2 })
994-
]);
981+
await Promise.all([setDoc(testDoc1, { test: 1 }), setDoc(testDoc2, { test: 2 })]);
995982

996983
await syncPromise;
997984

998985
// Verify unsubscribe worked by doing another write
999986
await setDoc(testDoc1, { test: 3 });
1000987

1001988
// Cleanup
1002-
await Promise.all([
1003-
deleteDoc(testDoc1),
1004-
deleteDoc(testDoc2)
1005-
]);
989+
await Promise.all([deleteDoc(testDoc1), deleteDoc(testDoc2)]);
1006990

1007991
events.length.should.be.greaterThan(0);
1008992
events.forEach(event => event.should.equal('sync'));

0 commit comments

Comments
 (0)