From 06f089afda45931aabf0c4a21b5dba217f18d899 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Thu, 4 Aug 2022 16:02:16 -0400 Subject: [PATCH] test: fix user email tests --- src/user/create.js | 2 +- test/user.js | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/user/create.js b/src/user/create.js index a278297db7..f0ef5f37fc 100644 --- a/src/user/create.js +++ b/src/user/create.js @@ -109,7 +109,7 @@ module.exports = function (User) { } if (userData.email && userData.uid > 1) { - User.email.sendValidationEmail(userData.uid, { + await User.email.sendValidationEmail(userData.uid, { email: userData.email, template: 'welcome', subject: `[[email:welcome-to, ${meta.config.title || meta.config.browserTitle || 'NodeBB'}]]`, diff --git a/test/user.js b/test/user.js index f8e09d7493..875e5fab1e 100644 --- a/test/user.js +++ b/test/user.js @@ -81,13 +81,14 @@ describe('User', () => { }); it('should be created properly', async () => { - const uid = await User.create({ username: 'weirdemail', email: '

test

@gmail.com' }); + const email = '

test

@gmail.com'; + const uid = await User.create({ username: 'weirdemail', email: email }); const data = await User.getUserData(uid); - const validationPending = await User.email.isValidationPending(uid, '

test

@gmail.com'); + const validationPending = await User.email.isValidationPending(uid, email); assert.strictEqual(validationPending, true); - assert.equal(data.email, ''); + assert.equal(data.email, '<h1>test</h1>@gmail.com'); assert.strictEqual(data.profileviews, 0); assert.strictEqual(data.reputation, 0); assert.strictEqual(data.postcount, 0);