refactor: helpers.loginUser to be fully async

This commit is contained in:
Julian Lam
2023-01-04 16:07:25 -05:00
parent a344e6ec0c
commit fecdab8b6f
8 changed files with 189 additions and 347 deletions

View File

@@ -150,7 +150,6 @@ describe('email confirmation (v3 api)', () => {
resolve({ jar, response, body });
});
});
const login = util.promisify(helpers.loginUser);
before(async () => {
// If you're running this file directly, uncomment these lines
@@ -219,7 +218,7 @@ describe('email confirmation (v3 api)', () => {
it('should still confirm the email (as email is set in user hash)', async () => {
await user.email.remove(userObj.uid);
await user.setUserField(userObj.uid, 'email', 'test@example.org');
({ jar } = await login('email-test', 'abcdef')); // email removal logs out everybody
({ jar } = await helpers.loginUser('email-test', 'abcdef')); // email removal logs out everybody
await groups.join('administrators', userObj.uid);
const { res, body } = await helpers.request('post', `/api/v3/users/${userObj.uid}/emails/${encodeURIComponent('test@example.org')}/confirm`, {