Files
query-orchestration/test/unit/internal/result/parse_test.go
T
Michael McGuinness 827d973053 a bit more testing
2024-12-24 12:47:40 +00:00

38 lines
902 B
Go

package document_test
import (
"gotemplate/internal/database/repository"
"gotemplate/internal/result"
"testing"
"github.com/google/uuid"
"github.com/jackc/pgx/v5/pgtype"
"github.com/stretchr/testify/assert"
)
func TestParseValue(t *testing.T) {
dbResult := repository.ListResultValuesByIDRow{
ID: pgtype.UUID{},
Queryid: pgtype.UUID{},
Value: "",
}
value := result.ParseValue(&dbResult)
assert.Equal(t, dbResult.Value, value.Value)
assert.Equal(t, uuid.Nil, value.ID)
assert.Equal(t, uuid.Nil, value.QueryID)
}
func TestParseResultValue(t *testing.T) {
dbResult := repository.ListResultsByDocumentIDRow{
ID: pgtype.UUID{},
Queryid: pgtype.UUID{},
Queryversion: int32(1),
}
value := result.Parse(&dbResult)
assert.Equal(t, dbResult.Queryversion, value.QueryVersion)
assert.Equal(t, uuid.Nil, value.ID)
assert.Equal(t, uuid.Nil, value.QueryID)
}