chore: add not found case for GetUserByEmail test
This commit is contained in:
parent
dd0bef7590
commit
9220753210
1 changed files with 11 additions and 0 deletions
|
|
@ -55,6 +55,7 @@ func RunSuite(t *testing.T, newStore Factory) {
|
||||||
{"CreateUser_duplicateEmail", testCreateUserDuplicateEmail},
|
{"CreateUser_duplicateEmail", testCreateUserDuplicateEmail},
|
||||||
{"CreateUser_duplicateUsernameNormalized", testCreateUserDuplicateUsernameNormalized},
|
{"CreateUser_duplicateUsernameNormalized", testCreateUserDuplicateUsernameNormalized},
|
||||||
{"CreateUser_GetUserByEmail_roundTrip", testCreateUserGetUserByEmailRoundTrip},
|
{"CreateUser_GetUserByEmail_roundTrip", testCreateUserGetUserByEmailRoundTrip},
|
||||||
|
{"GetUserByEmail_notFound", testGetUserByEmailNotFound},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, tc := range cases {
|
for _, tc := range cases {
|
||||||
|
|
@ -156,6 +157,16 @@ func testCreateUserGetUserByEmailRoundTrip(t *testing.T, s SuiteStore) {
|
||||||
AssertUserEqual(t, got, want)
|
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
|
// Fixtures and helpers. Exported so dialect-specific tests can reuse them
|
||||||
// for one-off cases that don't fit into the shared suite.
|
// for one-off cases that don't fit into the shared suite.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue