avoid-duplicate-test-assertions
preset: recommended
Warns when a test case has multiple test assertions with the same expression and expected value.
Multiple test assertions with the same expression and expected value are redundant and usually are the result of a typo.
Example
❌ Bad:
void withEmpty() {
final array = [1, 2, 3];
expect(array, isEmpty);
// LINT: This test already has an assertion with the same expression and expected value. Try removing this assertion or changing it.
expect(array, isEmpty);
}
✅ Good:
void withEmpty() {
final array = [1, 2, 3];
expect(array, isEmpty);
expect(array, contains(1)); // Correct, different assertion
}