chore: add not found case for GetUserByEmail test

This commit is contained in:
juancwu 2026-05-06 00:47:04 +00:00
commit 9220753210

View file

@ -55,6 +55,7 @@ func RunSuite(t *testing.T, newStore Factory) {
{"CreateUser_duplicateEmail", testCreateUserDuplicateEmail},
{"CreateUser_duplicateUsernameNormalized", testCreateUserDuplicateUsernameNormalized},
{"CreateUser_GetUserByEmail_roundTrip", testCreateUserGetUserByEmailRoundTrip},
{"GetUserByEmail_notFound", testGetUserByEmailNotFound},
}
for _, tc := range cases {
@ -156,6 +157,16 @@ func testCreateUserGetUserByEmailRoundTrip(t *testing.T, s SuiteStore) {
AssertUserEqual(t, got, want)
}
func testGetUserByEmailNotFound(t *testing.T, s SuiteStore) {
got, err := s.GetUserByEmail(context.Background(), "does-not-exist@mail.com")
if err == nil {
t.Fatalf("expected error, got user %+v", got)
}
if !errors.Is(err, store.ErrUserNotFound) {
t.Errorf("expected ErrUserNotFound, got: %v", err)
}
}
// ---------------------------------------------------------------------------
// Fixtures and helpers. Exported so dialect-specific tests can reuse them
// for one-off cases that don't fit into the shared suite.