aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests/api/check-params
diff options
context:
space:
mode:
Diffstat (limited to 'server/tests/api/check-params')
-rw-r--r--server/tests/api/check-params/users.ts17
1 files changed, 13 insertions, 4 deletions
diff --git a/server/tests/api/check-params/users.ts b/server/tests/api/check-params/users.ts
index f4c177621..05f42bca9 100644
--- a/server/tests/api/check-params/users.ts
+++ b/server/tests/api/check-params/users.ts
@@ -103,13 +103,13 @@ describe('Test users API validators', function () {
103 } 103 }
104 104
105 it('Should fail with a too small username', async function () { 105 it('Should fail with a too small username', async function () {
106 const fields = immutableAssign(baseCorrectParams, { username: 'fi' }) 106 const fields = immutableAssign(baseCorrectParams, { username: '' })
107 107
108 await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields }) 108 await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields })
109 }) 109 })
110 110
111 it('Should fail with a too long username', async function () { 111 it('Should fail with a too long username', async function () {
112 const fields = immutableAssign(baseCorrectParams, { username: 'my_super_username_which_is_very_long' }) 112 const fields = immutableAssign(baseCorrectParams, { username: 'super'.repeat(11) })
113 113
114 await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields }) 114 await makePostBodyRequest({ url: server.url, path, token: server.accessToken, fields })
115 }) 115 })
@@ -432,6 +432,14 @@ describe('Test users API validators', function () {
432 await makePutBodyRequest({ url: server.url, path: path + userId, token: server.accessToken, fields }) 432 await makePutBodyRequest({ url: server.url, path: path + userId, token: server.accessToken, fields })
433 }) 433 })
434 434
435 it('Should fail with an invalid emailVerified attribute', async function () {
436 const fields = {
437 emailVerified: 'yes'
438 }
439
440 await makePutBodyRequest({ url: server.url, path: path + userId, token: server.accessToken, fields })
441 })
442
435 it('Should fail with an invalid videoQuota attribute', async function () { 443 it('Should fail with an invalid videoQuota attribute', async function () {
436 const fields = { 444 const fields = {
437 videoQuota: -90 445 videoQuota: -90
@@ -467,6 +475,7 @@ describe('Test users API validators', function () {
467 it('Should succeed with the correct params', async function () { 475 it('Should succeed with the correct params', async function () {
468 const fields = { 476 const fields = {
469 email: 'email@example.com', 477 email: 'email@example.com',
478 emailVerified: true,
470 videoQuota: 42, 479 videoQuota: 42,
471 role: UserRole.MODERATOR 480 role: UserRole.MODERATOR
472 } 481 }
@@ -545,13 +554,13 @@ describe('Test users API validators', function () {
545 } 554 }
546 555
547 it('Should fail with a too small username', async function () { 556 it('Should fail with a too small username', async function () {
548 const fields = immutableAssign(baseCorrectParams, { username: 'ji' }) 557 const fields = immutableAssign(baseCorrectParams, { username: '' })
549 558
550 await makePostBodyRequest({ url: server.url, path: registrationPath, token: server.accessToken, fields }) 559 await makePostBodyRequest({ url: server.url, path: registrationPath, token: server.accessToken, fields })
551 }) 560 })
552 561
553 it('Should fail with a too long username', async function () { 562 it('Should fail with a too long username', async function () {
554 const fields = immutableAssign(baseCorrectParams, { username: 'my_super_username_which_is_very_long' }) 563 const fields = immutableAssign(baseCorrectParams, { username: 'super'.repeat(11) })
555 564
556 await makePostBodyRequest({ url: server.url, path: registrationPath, token: server.accessToken, fields }) 565 await makePostBodyRequest({ url: server.url, path: registrationPath, token: server.accessToken, fields })
557 }) 566 })