mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-06-12 05:20:59 +02:00
fix: breaking test for email confirmation API call
This commit is contained in:
@@ -2,6 +2,14 @@ get:
|
||||
tags:
|
||||
- authentication
|
||||
summary: Verify an email address
|
||||
parameters:
|
||||
- in: path
|
||||
name: code
|
||||
schema:
|
||||
type: string
|
||||
required: true
|
||||
description: a valid confirmation code
|
||||
example: f8c4a54a-47ae-40f5-a0a5-356d6a35c24e
|
||||
responses:
|
||||
"200":
|
||||
description: Email address verified, or confirmation code was incorrect
|
||||
|
||||
13
test/api.js
13
test/api.js
@@ -49,6 +49,13 @@ describe('API', async () => {
|
||||
}, nconf.get('secret')))(),
|
||||
},
|
||||
],
|
||||
'/api/confirm/{code}': [
|
||||
{
|
||||
in: 'path',
|
||||
name: 'code',
|
||||
example: '', // to be defined later...
|
||||
},
|
||||
],
|
||||
},
|
||||
post: {},
|
||||
put: {},
|
||||
@@ -110,12 +117,14 @@ describe('API', async () => {
|
||||
}
|
||||
|
||||
// Create sample users
|
||||
const adminUid = await user.create({ username: 'admin', password: '123456', email: 'test@example.org' });
|
||||
const unprivUid = await user.create({ username: 'unpriv', password: '123456', email: 'unpriv@example.org' });
|
||||
const adminUid = await user.create({ username: 'admin', password: '123456' });
|
||||
const unprivUid = await user.create({ username: 'unpriv', password: '123456' });
|
||||
const emailConfirmationUid = await user.create({ username: 'emailConf', email: 'emailConf@example.org' });
|
||||
await user.setUserField(adminUid, 'email', 'test@example.org');
|
||||
await user.setUserField(unprivUid, 'email', 'unpriv@example.org');
|
||||
await user.email.confirmByUid(adminUid);
|
||||
await user.email.confirmByUid(unprivUid);
|
||||
mocks.get['/api/confirm/{code}'][0].example = await db.get(`confirm:byUid:${emailConfirmationUid}`);
|
||||
|
||||
for (let x = 0; x < 4; x++) {
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
|
||||
Reference in New Issue
Block a user