User: Handle unique constraints errors (#101274)
* Handle unique constraints errors
This commit is contained in:
@@ -68,6 +68,19 @@ func TestIntegrationUserDataAccess(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
})
|
||||
|
||||
t.Run("error on duplicated user", func(t *testing.T) {
|
||||
_, err := userStore.Insert(context.Background(),
|
||||
&user.User{
|
||||
Email: "test@email.com",
|
||||
Name: "test1",
|
||||
Login: "test1",
|
||||
Created: time.Now(),
|
||||
Updated: time.Now(),
|
||||
},
|
||||
)
|
||||
require.ErrorIs(t, err, user.ErrUserAlreadyExists)
|
||||
})
|
||||
|
||||
t.Run("get user", func(t *testing.T) {
|
||||
_, err := userStore.GetByEmail(context.Background(),
|
||||
&user.GetUserByEmailQuery{Email: "test@email.com"},
|
||||
|
||||
Reference in New Issue
Block a user