Awesome Reviewers

Reviewer · Testing

Targeted test coverage

Design tests to be both complete and precise: cover every meaningful state or branch of the logic under test, scope assertions to what the unit actually owns, and confirm the test setup genuinely exercises the code path being verified.

Instruction

Design tests to be both complete and precise: cover every meaningful state or branch of the logic under test, scope assertions to what the unit actually owns, and confirm the test setup genuinely exercises the code path being verified.

  • Cover all distinct states, not just the common ones. If a value can be true, false, or null/undefined and each renders differently, add a test case for each outcome rather than assuming the “happy path” is sufficient.
it.each([
  [true, 'Yes'],
  [false, 'No'],
  [null, ''],
])('renders %s as %s', (value, expected) => {
  render(<SessionsTable replay={value} />);
  expect(screen.getByTestId('replay-cell')).toHaveTextContent(expected);
});
  • Avoid duplicating coverage that belongs to a dependency. If a page composes a shared component (e.g. a shared app header) that already has its own tests for specific behaviors (menu items, ordering, etc.), the page’s test suite should only assert what the page itself is responsible for, mocking the shared component’s internals instead of re-testing them.

  • Verify that test fixtures/builders actually trigger the behavior you intend to assert. If a callback only fires for a specific registered type/strategy, make sure the test registers and uses that type—otherwise the assertion may pass trivially without ever exercising the code path, giving false confidence in coverage.

Before merging a test, ask: does it cover all relevant branches, is it scoped to the unit under test, and does it actually invoke the behavior it claims to validate?