TestInvalid just ensures the false case is asserted by some tests. Otherwise, a function that just `returns true` might pass all tests incorrectly.
(t *testing.T)
| 176 | // TestInvalid just ensures the false case is asserted by some tests. |
| 177 | // Otherwise, a function that just `returns true` might pass all tests incorrectly. |
| 178 | func TestInvalid(t *testing.T) { |
| 179 | t.Parallel() |
| 180 | |
| 181 | require.Falsef(t, apikey.ValidateHash([]byte{}, "secret"), "empty hash") |
| 182 | |
| 183 | secret, hash, err := apikey.GenerateSecret(10) |
| 184 | require.NoError(t, err) |
| 185 | |
| 186 | require.Falsef(t, apikey.ValidateHash(hash, secret+"_"), "different secret") |
| 187 | require.Falsef(t, apikey.ValidateHash(hash[:len(hash)-1], secret), "different hash length") |
| 188 | } |
nothing calls this directly
no test coverage detected