diff --git a/store/storetest/storetest.go b/store/storetest/storetest.go index 2f02a69..ae68f26 100644 --- a/store/storetest/storetest.go +++ b/store/storetest/storetest.go @@ -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.