Back to all reviewers

Write clear test cases

sveltejs/svelte
Based on 2 comments
Other

Tests should be written with clear intent and expectations. Use descriptive names that accurately reflect what the test validates, and include both positive and negative test cases to demonstrate expected behavior through contrast. Organize tests in appropriate suites based on their purpose (e.g., validation tests vs. runtime tests).

Testing Other

Reviewer Prompt

Tests should be written with clear intent and expectations. Use descriptive names that accurately reflect what the test validates, and include both positive and negative test cases to demonstrate expected behavior through contrast. Organize tests in appropriate suites based on their purpose (e.g., validation tests vs. runtime tests).

For example, when testing error conditions, include a passing case above the failing case:

function validFunction() {
    return $state(1); // This should pass
}

function invalidFunction() {
    return $state(1); // This should throw, as expected
}

Avoid confusing names like importing something called “broken” when it’s actually working correctly. Instead, use names that clearly indicate the test’s purpose and expected outcome.

2
Comments Analyzed
Other
Primary Language
Testing
Category

Source Discussions