hiling_go/db/sqlc/test/users_test.go

24 lines
503 B
Go

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)
}