Ctrl + K
DocumentationLog inGet started

tessl/npm-jest-circus

tessl install tessl/npm-jest-circus@29.7.0

The next-gen flux-based test runner for Jest that provides test framework globals and event-driven test execution

Agent Success

Agent success rate when using this tile

82%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.91x

Baseline

Agent success rate without this tile

43%

task.mdevals/scenario-3/

Email Validator Test Suite

A test suite for an email validation function that checks various email format rules.

Background

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.

Requirements

Test Coverage

Write tests that verify the email validator correctly handles multiple test cases in an efficient, maintainable way. The tests should cover:

  • Valid email formats that should return true
  • Invalid email formats that should return false
  • Edge cases like empty strings, missing parts, special characters

Test Organization

Your test suite should:

  • Use a table-driven approach where test cases are defined in a structured, readable format
  • Each test case should include: the input email, the expected result, and a description of what makes it valid or invalid
  • Run all test cases with minimal code repetition
  • Generate clear test output that shows which specific test case failed

Test Implementation

  • Implement your tests in email.test.js
  • Use the test framework's features to run multiple test cases from a single test definition
  • The test table should have columns for: email, expected, and reason
  • Include at least 6 different test cases covering both valid and invalid scenarios

Example Test Cases

Your 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

API

/**
 * 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 };

Test Cases

  • Valid email "user@example.com" returns true with reason "standard format" @test
  • Invalid email "invalid.email" returns false with reason "missing @ symbol" @test
  • Invalid email "user @example.com" returns false with reason "contains space" @test
  • Invalid email "user@domain" returns false with reason "missing top-level domain" @test
  • Valid email "user+tag@example.com" returns true with reason "plus addressing" @test
  • Invalid email "" returns false with reason "empty string" @test

Dependencies { .dependencies }

jest { .dependency }

JavaScript testing framework for writing and running tests.

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
npmpkg:npm/jest-circus@29.7.x
tile.json