From 576ad67aaccf713b2a923deb3cb9b2a990613985 Mon Sep 17 00:00:00 2001 From: Josh Morel Date: Sun, 17 Feb 2019 13:14:00 -0500 Subject: check email enabled for requiresEmailVer config --- server/tests/api/check-params/config.ts | 19 +++++++++++++++++++ server/tests/api/server/config.ts | 4 ++-- 2 files changed, 21 insertions(+), 2 deletions(-) (limited to 'server/tests/api') diff --git a/server/tests/api/check-params/config.ts b/server/tests/api/check-params/config.ts index 07de2b5a5..3895c4f9a 100644 --- a/server/tests/api/check-params/config.ts +++ b/server/tests/api/check-params/config.ts @@ -167,6 +167,25 @@ describe('Test config API validators', function () { }) }) + it('Should fail if email disabled and signup requires email verification', async function () { + // opposite scenario - succcess when enable enabled - covered via tests/api/users/user-verification.ts + const newUpdateParams = immutableAssign(updateParams, { + signup: { + enabled: true, + limit: 5, + requiresEmailVerification: true + } + }) + + await makePutBodyRequest({ + url: server.url, + path, + fields: newUpdateParams, + token: server.accessToken, + statusCodeExpected: 400 + }) + }) + it('Should success with the correct parameters', async function () { await makePutBodyRequest({ url: server.url, diff --git a/server/tests/api/server/config.ts b/server/tests/api/server/config.ts index 0dfe6e4fe..3be1c9431 100644 --- a/server/tests/api/server/config.ts +++ b/server/tests/api/server/config.ts @@ -81,7 +81,7 @@ function checkUpdatedConfig (data: CustomConfig) { expect(data.signup.enabled).to.be.false expect(data.signup.limit).to.equal(5) - expect(data.signup.requiresEmailVerification).to.be.true + expect(data.signup.requiresEmailVerification).to.be.false expect(data.admin.email).to.equal('superadmin1@example.com') expect(data.contactForm.enabled).to.be.false @@ -186,7 +186,7 @@ describe('Test config', function () { signup: { enabled: false, limit: 5, - requiresEmailVerification: true + requiresEmailVerification: false }, admin: { email: 'superadmin1@example.com' -- cgit v1.2.3