package db

import (
	"context"
	"testing"

	"git.nochill.in/nochill/naice_pos/util"
	"github.com/google/uuid"
	"github.com/stretchr/testify/require"
)

func createRandomSupplier(t *testing.T) (Supplier, CreateSuppliersParams) {
	arg := CreateSuppliersParams{
		MerchantID: uuid.MustParse("a848090f-0409-4386-9caa-929ae6874dbb"),
		Name:       util.RandomString(10),
	}

	supplier, err := testQueries.CreateSuppliers(context.Background(), arg)
	require.NoError(t, err)

	return supplier, arg

}
func TestCreateSupplier(t *testing.T) {
	supplier, arg := createRandomSupplier(t)

	require.Equal(t, arg.Name, supplier.Name)
	require.Equal(t, arg.MerchantID, supplier.MerchantID)

	require.NotZero(t, supplier.ID)
	require.NotZero(t, supplier.CreatedAt)
	require.NotZero(t, supplier.UpdatedAt)

}