From f36a48f2d39a3bd5032bd8530509667bbd37ab49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20Fra=C3=9F?= Date: Sun, 12 May 2024 11:31:20 +0200 Subject: [PATCH] =?UTF-8?q?[mod]=20tests:mehr=20tests=20f=C3=BCr=20"servic?= =?UTF-8?q?e.member.validate=5Fpassword"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- source/tests.mocha.ts | 156 ++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 152 insertions(+), 4 deletions(-) diff --git a/source/tests.mocha.ts b/source/tests.mocha.ts index 5e2ee10..93b413a 100644 --- a/source/tests.mocha.ts +++ b/source/tests.mocha.ts @@ -19,7 +19,7 @@ describe( } > = [ { - "name": "minimum_length:negative", + "name": "minimum_length:pass", "input": { "conf": { "settings": { @@ -38,7 +38,7 @@ describe( ] }, { - "name": "minimum_lengt:positive", + "name": "minimum_lengt:fail", "input": { "conf": { "settings": { @@ -64,7 +64,7 @@ describe( ] }, { - "name": "maximum_length:negative", + "name": "maximum_length:pass", "input": { "conf": { "settings": { @@ -83,7 +83,7 @@ describe( ] }, { - "name": "maximum_lengt:positive", + "name": "maximum_length:fail", "input": { "conf": { "settings": { @@ -108,6 +108,154 @@ describe( } ] }, + { + "name": "must_contain_letter:pass", + "input": { + "conf": { + "settings": { + "password_policy": { + "minimum_length": null, + "maximum_length": null, + "must_contain_letter": true, + "must_contain_number": false, + "must_contain_special_character": false, + } + } + }, + "password": "01x34" + }, + "output": [ + ] + }, + { + "name": "must_contain_letter:fail", + "input": { + "conf": { + "settings": { + "password_policy": { + "minimum_length": null, + "maximum_length": null, + "must_contain_letter": true, + "must_contain_number": false, + "must_contain_special_character": false, + } + } + }, + "password": "01234" + }, + "output": [ + { + "incident": "lacks_letter", + "details": { + } + } + ] + }, + { + "name": "must_contain_number:pass", + "input": { + "conf": { + "settings": { + "password_policy": { + "minimum_length": null, + "maximum_length": null, + "must_contain_letter": false, + "must_contain_number": true, + "must_contain_special_character": false, + } + } + }, + "password": "ab0de" + }, + "output": [ + ] + }, + { + "name": "must_contain_number:fail", + "input": { + "conf": { + "settings": { + "password_policy": { + "minimum_length": null, + "maximum_length": null, + "must_contain_letter": false, + "must_contain_number": true, + "must_contain_special_character": false, + } + } + }, + "password": "abcde" + }, + "output": [ + { + "incident": "lacks_number", + "details": { + } + } + ] + }, + { + "name": "must_contain_special_character:pass", + "input": { + "conf": { + "settings": { + "password_policy": { + "minimum_length": null, + "maximum_length": null, + "must_contain_letter": false, + "must_contain_number": false, + "must_contain_special_character": true, + } + } + }, + "password": "01.34" + }, + "output": [ + ] + }, + { + "name": "must_contain_special_character:fail", + "input": { + "conf": { + "settings": { + "password_policy": { + "minimum_length": null, + "maximum_length": null, + "must_contain_letter": false, + "must_contain_number": false, + "must_contain_special_character": true, + } + } + }, + "password": "01234" + }, + "output": [ + { + "incident": "lacks_special_character", + "details": { + } + } + ] + }, + { + "name": "oblique:pass", + "input": { + "conf": { + "settings": { + "password_policy": { + "minimum_length": 8, + "maximum_length": 12, + "must_contain_letter": true, + "must_contain_number": true, + "must_contain_special_character": true, + } + } + }, + "password": "eiB@oo7tuu" + }, + "output": [ + ] + }, ]; cases.forEach( case_ => {