hiling_go/db/sqlc/test/users_test.go
2024-05-22 11:26:15 +07:00

24 lines
503 B
Go
Executable File

package db_test
import (
"context"
"testing"
db "git.nochill.in/nochill/hiling_go/db/sqlc"
"git.nochill.in/nochill/hiling_go/util"
"github.com/stretchr/testify/require"
)
func TestCreateUser(t *testing.T) {
arg := db.CreateUserParams{
Username: util.RandomString(7),
Password: util.RandomString(10),
}
user, err := testQueries.CreateUser(context.Background(), arg)
require.NoError(t, err)
require.Equal(t, user.Username, arg.Username)
require.Equal(t, user.Password, arg.Password)
}