Forked from trycf/trycf-gist-1665526391316-71892cd7-d936-d18b-4ace-aa961b478ed5.cfm
Created
October 13, 2022 03:44
-
-
Save webmandman/14590280a85f6eea8bfd57042b126c3d to your computer and use it in GitHub Desktop.
TryCF Gist
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
function run() { | |
describe("some password validation tests", () => { | |
passwords = [ | |
{password="", ok=false}, | |
{password="Bad1!", ok=false}, | |
{password="Fine1!", ok=true}, | |
{password="AAAAAA", ok=false}, | |
{password="aaaaaa", ok=false}, | |
{password="111111", ok=false}, | |
{password="Aa1Aa1", ok=false}, | |
{password="Aa1Aa!", ok=true}, | |
{password="Aa1Aa!" & repeatString("x", 249), ok=true}, | |
{password="Aa1Aa!" & repeatString("x", 250), ok=false} | |
] | |
passwords.each((testCase) => { | |
it("should consider [#testCase.password#] to be valid: [#testCase.ok#]", () => { | |
expect(testCase.password.reFind("^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?=.*\W).{6,255}$") > 0).toBe(testCase.ok) | |
}) | |
}) | |
}) | |
} | |
tinyTest.runTests() | |
</cfscript> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment