From fa878234ad306b93a79af10b27962bcda5d2faed Mon Sep 17 00:00:00 2001 From: denihs Date: Thu, 8 Dec 2022 13:02:53 -0400 Subject: [PATCH] fixing "publish multiple cursors" test --- .../ddp-client/test/livedata_test_service.js | 58 ++++++++++--------- 1 file changed, 30 insertions(+), 28 deletions(-) diff --git a/packages/ddp-client/test/livedata_test_service.js b/packages/ddp-client/test/livedata_test_service.js index 8938a1a8ca..57c47b1e8d 100644 --- a/packages/ddp-client/test/livedata_test_service.js +++ b/packages/ddp-client/test/livedata_test_service.js @@ -333,36 +333,38 @@ if (Meteor.isServer) { One = new Mongo.Collection('collectionOne'); Two = new Mongo.Collection('collectionTwo'); -if (Meteor.isServer) { - One.remove({}); - One.insert({ name: 'value1' }); - One.insert({ name: 'value2' }); +Meteor.startup(async () => { + if (Meteor.isServer) { + await One.removeAsync({}); + await One.insertAsync({ name: 'value1' }); + await One.insertAsync({ name: 'value2' }); - Two.remove({}); - Two.insert({ name: 'value3' }); - Two.insert({ name: 'value4' }); - Two.insert({ name: 'value5' }); + await Two.removeAsync({}); + await Two.insertAsync({ name: 'value3' }); + await Two.insertAsync({ name: 'value4' }); + await Two.insertAsync({ name: 'value5' }); - Meteor.publish('multiPublish', function(options) { - // See below to see what options are accepted. - check(options, Object); - if (options.normal) { - return [One.find(), Two.find()]; - } else if (options.dup) { - // Suppress the log of the expected internal error. - Meteor._suppress_log(1); - return [ - One.find(), - One.find({ name: 'value2' }), // multiple cursors for one collection - error - Two.find() - ]; - } else if (options.notCursor) { - // Suppress the log of the expected internal error. - Meteor._suppress_log(1); - return [One.find(), 'not a cursor', Two.find()]; - } else throw 'unexpected options'; - }); -} + Meteor.publish('multiPublish', function(options) { + // See below to see what options are accepted. + check(options, Object); + if (options.normal) { + return [One.find(), Two.find()]; + } else if (options.dup) { + // Suppress the log of the expected internal error. + Meteor._suppress_log(1); + return [ + One.find(), + One.find({ name: 'value2' }), // multiple cursors for one collection - error + Two.find(), + ]; + } else if (options.notCursor) { + // Suppress the log of the expected internal error. + Meteor._suppress_log(1); + return [One.find(), 'not a cursor', Two.find()]; + } else throw 'unexpected options'; + }); + } +}); /// Helper for "livedata - result by value" const resultByValueArrays = Object.create(null);