31 lines
602 B
Go
31 lines
602 B
Go
package db
|
|
|
|
import (
|
|
"context"
|
|
"testing"
|
|
|
|
"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)
|
|
|
|
return user
|
|
}
|
|
|
|
func TestGetUserByID(t *testing.T) {
|
|
createRandomUser(t)
|
|
}
|