The next-gen flux-based test runner for Jest that provides test framework globals and event-driven test execution
82
A test suite for an email validation function that checks various email format rules.
You have been provided with an isValidEmail function that validates email addresses according to common rules (presence of @ symbol, valid domain, no spaces, etc.). Your task is to write comprehensive tests for this function using a data-driven testing approach.
Write tests that verify the email validator correctly handles multiple test cases in an efficient, maintainable way. The tests should cover:
truefalseYour test suite should:
email.test.jsemail, expected, and reasonYour test suite should include cases like:
"user@example.com" should be valid (standard format)"invalid.email" should be invalid (missing @ symbol)"user @example.com" should be invalid (contains space)"user@domain" should be invalid (missing top-level domain)"user+tag@example.com" should be valid (plus addressing)"" should be invalid (empty string)@generates
/**
* Validates an email address format
*
* @param {string} email - The email address to validate
* @returns {boolean} True if email is valid, false otherwise
*/
function isValidEmail(email) {
// Implementation provided
}
module.exports = { isValidEmail };JavaScript testing framework for writing and running tests.
Install with Tessl CLI
npx tessl i tessl/npm-jest-circusevals
scenario-1
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
scenario-10