From 64cc7937f97d7cc489a27b91e2ff2e36065f07ed Mon Sep 17 00:00:00 2001 From: Gabriel Grubba Date: Tue, 11 Nov 2025 10:58:18 -0300 Subject: [PATCH] DEV: make tests good --- packages/meteor/timers_tests.js | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/packages/meteor/timers_tests.js b/packages/meteor/timers_tests.js index 6406b90b26..1db203dd00 100644 --- a/packages/meteor/timers_tests.js +++ b/packages/meteor/timers_tests.js @@ -43,21 +43,35 @@ Tinytest.addAsync( { on: [] } ); test.equal(x, "b"); + onComplete(); } ); Tinytest.addAsync( - "timers - defer works with async functions", - async function (test, onComplete) { - let x = "a"; + "timers - deferrable works with async functions", + function (test, onComplete) { + let x = Meteor.deferrable( + function () { + return "start value"; + }, + { on: [] } + ); + test.equal(x, "start value"); + Meteor.deferrable( - async function () { - await new Promise((resolve) => setTimeout(resolve, 10)); - test.equal(x, "b"); + function () { + test.equal(x, "value"); onComplete(); }, { on: ["development", "production", "test"] } ); - await Meteor.deferrable(async () => (x = "b"), { on: [] }); + + Meteor.deferrable( + async function () { + return "value"; + }, + { on: [] } + ).then((value) => (x = value)); + } );