From bb5d8ea851898e1bad9cfc73e78b1a81d6e9cef9 Mon Sep 17 00:00:00 2001 From: Julian Lam Date: Fri, 27 Jan 2023 11:46:10 -0500 Subject: [PATCH] fix: breaking test for email confirmation API call --- public/openapi/read/confirm/code.yaml | 8 ++++++++ test/api.js | 13 +++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/public/openapi/read/confirm/code.yaml b/public/openapi/read/confirm/code.yaml index c3e75649b8..9d55b016c1 100644 --- a/public/openapi/read/confirm/code.yaml +++ b/public/openapi/read/confirm/code.yaml @@ -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 diff --git a/test/api.js b/test/api.js index ebd3cff702..6131ed6069 100644 --- a/test/api.js +++ b/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