From f449d3a952e662b3aa139dc8f6fe40ed8f4f997a Mon Sep 17 00:00:00 2001 From: denihs Date: Tue, 14 Feb 2023 10:44:03 -0400 Subject: [PATCH] - fix test: 'mongo-livedata - empty documents, MONGO | STRING' --- packages/mongo/mongo_livedata_tests.js | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/packages/mongo/mongo_livedata_tests.js b/packages/mongo/mongo_livedata_tests.js index 211289ed3a..5b4d92b164 100644 --- a/packages/mongo/mongo_livedata_tests.js +++ b/packages/mongo/mongo_livedata_tests.js @@ -1587,22 +1587,21 @@ _.each( ['STRING', 'MONGO'], function(idGeneration) { testAsyncMulti('mongo-livedata - empty documents, ' + idGeneration, [ - function (test, expect) { + function(test, expect) { this.collectionName = Random.id(); if (Meteor.isClient) { Meteor.call('createInsecureCollection', this.collectionName); Meteor.subscribe('c-' + this.collectionName, expect()); } - }, function (test, expect) { - var coll = new Mongo.Collection(this.collectionName, collectionOptions); + }, + async function(test, expect) { + const coll = new Mongo.Collection(this.collectionName, collectionOptions); - coll.insert({}, expect(function (err, id) { - test.isFalse(err); - test.isTrue(id); - var cursor = coll.find(); - test.equal(cursor.count(), 1); - })); - } + const id = await coll.insertAsync({}); + test.isTrue(id); + const cursor = coll.find(); + test.equal(await cursor.countAsync(), 1); + }, ]); // Regression test for #2413.