Code QuizAdvanced

Validating a Healthy Test Pyramid

Spot the logic bug in a function that checks whether a suite follows the test pyramid.

Codejavascript
// Test pyramid: many fast unit tests at the base,
// fewer integration tests, and the fewest slow E2E tests at the top.
function isHealthyPyramid(counts) {
  // counts = { unit, integration, e2e }
  return counts.unit > counts.integration &&
         counts.integration < counts.e2e;
}

console.log(isHealthyPyramid({ unit: 100, integration: 20, e2e: 5 }));

This function should return true only for a valid pyramid (unit > integration > e2e), but it misclassifies. What is the bug?