2023-03-13 09:24:59 +07:00
|
|
|
package db
|
|
|
|
|
2023-03-19 18:17:17 +07:00
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
"testing"
|
2023-03-13 09:24:59 +07:00
|
|
|
|
2023-03-19 18:17:17 +07:00
|
|
|
"git.nochill.in/nochill/naice_pos/util"
|
|
|
|
"github.com/stretchr/testify/require"
|
|
|
|
)
|
|
|
|
|
|
|
|
func createRandomUser(t *testing.T) User {
|
|
|
|
arg := CreateUserParams{
|
|
|
|
Email: util.RandomEmail(),
|
|
|
|
Password: util.RandomString(5),
|
|
|
|
Fullname: util.RandomString(6),
|
|
|
|
}
|
|
|
|
|
|
|
|
user, err := testQueries.CreateUser(context.Background(), arg)
|
|
|
|
|
|
|
|
require.NoError(t, err)
|
|
|
|
require.Equal(t, arg.Email, user.Email)
|
|
|
|
require.Equal(t, arg.Password, user.Password)
|
|
|
|
require.Equal(t, arg.Fullname, user.Fullname)
|
2023-03-13 09:24:59 +07:00
|
|
|
|
2023-03-19 18:17:17 +07:00
|
|
|
return user
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestGetUserByID(t *testing.T) {
|
|
|
|
createRandomUser(t)
|
2023-03-13 09:24:59 +07:00
|
|
|
}
|