38 lines
902 B
Go
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)
|
|
}
|