A Jest test that mocked the module under test

A test file that mocked the module it imported, so it asserted the behaviour of the mock and passed after the implementation was deleted.

jest.mock('./pricing')          // ← the module under test
import { calculate } from './pricing'

test('applies the discount', () => {
  calculate.mockReturnValue(90)
  expect(calculate(100)).toBe(90)   // passes, always
})

It had been added to work around a slow import chain and had passed for two years including the week the function was rewritten. The general defence is a mutation check or, more cheaply, deleting the implementation and confirming the test fails — which takes thirty seconds per suspicious file and is worth doing after any test that has never failed.