From 7b2d553b8eb3f8ff002adcfd36510f13805be90d Mon Sep 17 00:00:00 2001 From: Gabriel Grubba Date: Tue, 20 Dec 2022 18:07:39 -0300 Subject: [PATCH] test: solved add email when user has not an existing email --- packages/accounts-password/password_tests.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/accounts-password/password_tests.js b/packages/accounts-password/password_tests.js index 6080c6d012..ee2ea80ff5 100644 --- a/packages/accounts-password/password_tests.js +++ b/packages/accounts-password/password_tests.js @@ -1735,15 +1735,16 @@ if (Meteor.isServer) (() => { Accounts._options = options; }); - Tinytest.add("passwords - add email when user has not an existing email", test => { - const userId = Accounts.createUser({ + Tinytest.addAsync("passwords - add email when user has not an existing email", + async test => { + const userId = await Accounts.createUser({ username: `user${ Random.id() }` }); const newEmail = `${ Random.id() }@turing.com`; - Accounts.addEmail(userId, newEmail); - - test.equal(Accounts._findUserByQuery({ id: userId }).emails, [ + await Accounts.addEmail(userId, newEmail); + const u1 = await Accounts._findUserByQuery({ id: userId }) + test.equal(u1.emails, [ { address: newEmail, verified: false }, ]); });