Merged in feature/update (pull request #27)
Query Update * baselineupdate * baseupdateplusmodelupdates * passtests * somemoresubmittesting * testinnerfunctions * readmeandinstall * cleanerstartup * readmeplusdeps * tidyatrighttime * validatetests * normalizedontvalidate * abitofzenormalizationcleanup * addunitstestforhelperfuns * normalizeactiveversiontestas
This commit is contained in:
@@ -10,16 +10,17 @@ import (
|
||||
)
|
||||
|
||||
func TestParseQueries(t *testing.T) {
|
||||
cfg := "hey"
|
||||
in := []*query.Query{
|
||||
{
|
||||
ID: uuid.New(),
|
||||
Type: queryprocessor.TypeContextFull,
|
||||
ActiveVersion: 1,
|
||||
LatestVersion: 2,
|
||||
RequiredQueryIDs: []uuid.UUID{
|
||||
RequiredQueryIDs: &[]uuid.UUID{
|
||||
uuid.New(),
|
||||
},
|
||||
Config: "hey",
|
||||
Config: &cfg,
|
||||
},
|
||||
}
|
||||
out, err := parseQueries(in)
|
||||
@@ -31,24 +32,25 @@ func TestParseQueries(t *testing.T) {
|
||||
Type: CONTEXTFULL,
|
||||
ActiveVersion: 1,
|
||||
LatestVersion: 2,
|
||||
RequiredQueries: []string{
|
||||
in[0].RequiredQueryIDs[0].String(),
|
||||
RequiredQueries: &[]string{
|
||||
(*in[0].RequiredQueryIDs)[0].String(),
|
||||
},
|
||||
Config: &in[0].Config,
|
||||
Config: in[0].Config,
|
||||
},
|
||||
}, out)
|
||||
}
|
||||
|
||||
func TestParseQuery(t *testing.T) {
|
||||
cfg := "hey"
|
||||
in := &query.Query{
|
||||
ID: uuid.New(),
|
||||
Type: queryprocessor.TypeContextFull,
|
||||
ActiveVersion: 1,
|
||||
LatestVersion: 2,
|
||||
RequiredQueryIDs: []uuid.UUID{
|
||||
RequiredQueryIDs: &[]uuid.UUID{
|
||||
uuid.New(),
|
||||
},
|
||||
Config: "hey",
|
||||
Config: &cfg,
|
||||
}
|
||||
out, err := parseQuery(in)
|
||||
assert.Nil(t, err)
|
||||
@@ -57,10 +59,28 @@ func TestParseQuery(t *testing.T) {
|
||||
Type: CONTEXTFULL,
|
||||
ActiveVersion: 1,
|
||||
LatestVersion: 2,
|
||||
RequiredQueries: []string{
|
||||
in.RequiredQueryIDs[0].String(),
|
||||
RequiredQueries: &[]string{
|
||||
(*in.RequiredQueryIDs)[0].String(),
|
||||
},
|
||||
Config: &in.Config,
|
||||
Config: in.Config,
|
||||
},
|
||||
*out)
|
||||
}
|
||||
|
||||
func TestParseQueryMinimal(t *testing.T) {
|
||||
in := &query.Query{
|
||||
ID: uuid.New(),
|
||||
Type: queryprocessor.TypeContextFull,
|
||||
ActiveVersion: 1,
|
||||
LatestVersion: 2,
|
||||
}
|
||||
out, err := parseQuery(in)
|
||||
assert.Nil(t, err)
|
||||
assert.EqualExportedValues(t, Query{
|
||||
Id: in.ID.String(),
|
||||
Type: CONTEXTFULL,
|
||||
ActiveVersion: 1,
|
||||
LatestVersion: 2,
|
||||
},
|
||||
*out)
|
||||
}
|
||||
@@ -90,3 +110,16 @@ func TestParseSpecQueryType(t *testing.T) {
|
||||
_, err = parseSpecQueryType("invalid")
|
||||
assert.NotNil(t, err)
|
||||
}
|
||||
|
||||
func TestParseStringToUUIDArray(t *testing.T) {
|
||||
ids := []uuid.UUID{uuid.New()}
|
||||
|
||||
out, err := parseStringToUUIDArray(&[]string{ids[0].String()})
|
||||
assert.Nil(t, err)
|
||||
assert.ElementsMatch(t, ids, *out)
|
||||
_, err = parseStringToUUIDArray(&[]string{"invalid_uuid"})
|
||||
assert.Error(t, err)
|
||||
out, err = parseStringToUUIDArray(nil)
|
||||
assert.Nil(t, err)
|
||||
assert.Nil(t, out)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user