Challenge: Test a Function
Explore how to create a function that validates usernames based on a specific pattern and write unit tests to verify its correctness. This lesson helps you understand regex usage and testing practices to ensure input validation in your AdonisJs projects.
We'll cover the following...
We'll cover the following...
Problem statement
Suppose that we want the username to contain at least one letter followed by at least one number. Implement a function that checks this and write unit tests to test the function. ...