test: solved add email when user has not an existing email

This commit is contained in:
Gabriel Grubba
2022-12-20 18:07:39 -03:00
parent cfba9458c4
commit 7b2d553b8e

View File

@@ -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 },
]);
});