A keyed hash's test only checked that the keyed output differs from the bare one and repeats for the same key. Swap the real secret for a constant in the code and every test stays green while the outputs turn guessable.
Pin a keyed hash to its key. Assert the exact output under one secret and a different one under another, or a constant key passes.