518927c395
Query Update * baselineupdate * baseupdateplusmodelupdates * passtests * somemoresubmittesting * testinnerfunctions * readmeandinstall * cleanerstartup * readmeplusdeps * tidyatrighttime * validatetests * normalizedontvalidate * abitofzenormalizationcleanup * addunitstestforhelperfuns * normalizeactiveversiontestas
94 lines
2.1 KiB
Go
94 lines
2.1 KiB
Go
package queryprocessor_test
|
|
|
|
import (
|
|
queryprocessor "queryorchestration/internal/query/processor"
|
|
"testing"
|
|
|
|
"github.com/google/uuid"
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestCreateGetConfig(t *testing.T) {
|
|
entity := queryprocessor.Create{}
|
|
|
|
assert.Nil(t, entity.GetConfig())
|
|
|
|
cfg := "example_config"
|
|
entity.Config = &cfg
|
|
assert.NotNil(t, entity.GetConfig())
|
|
assert.Equal(t, cfg, *entity.GetConfig())
|
|
}
|
|
|
|
func TestCreateSetConfig(t *testing.T) {
|
|
entity := queryprocessor.Create{}
|
|
|
|
assert.Nil(t, entity.Config)
|
|
|
|
cfg := "example_config"
|
|
entity.SetConfig(&cfg)
|
|
assert.Equal(t, cfg, *entity.Config)
|
|
}
|
|
|
|
func TestUpdateGetConfig(t *testing.T) {
|
|
entity := queryprocessor.Update{}
|
|
|
|
assert.Nil(t, entity.GetConfig())
|
|
|
|
cfg := "example_config"
|
|
entity.Config = &cfg
|
|
assert.NotNil(t, entity.GetConfig())
|
|
assert.Equal(t, cfg, *entity.GetConfig())
|
|
}
|
|
|
|
func TestUpdateSetConfig(t *testing.T) {
|
|
entity := queryprocessor.Update{}
|
|
|
|
assert.Nil(t, entity.Config)
|
|
|
|
cfg := "example_config"
|
|
entity.SetConfig(&cfg)
|
|
assert.Equal(t, cfg, *entity.Config)
|
|
}
|
|
|
|
func TestCreateGetRequiredQueryIDs(t *testing.T) {
|
|
entity := queryprocessor.Create{}
|
|
|
|
assert.Nil(t, entity.GetRequiredQueryIDs())
|
|
|
|
ids := []uuid.UUID{uuid.New()}
|
|
entity.RequiredQueryIDs = &ids
|
|
assert.NotNil(t, entity.GetRequiredQueryIDs())
|
|
assert.Equal(t, ids, *entity.GetRequiredQueryIDs())
|
|
}
|
|
|
|
func TestCreateSetRequiredQueryIDs(t *testing.T) {
|
|
entity := queryprocessor.Create{}
|
|
|
|
assert.Nil(t, entity.RequiredQueryIDs)
|
|
|
|
ids := []uuid.UUID{uuid.New()}
|
|
entity.SetRequiredQueryIDs(&ids)
|
|
assert.Equal(t, ids, *entity.RequiredQueryIDs)
|
|
}
|
|
|
|
func TestUpdateGetRequiredQueryIDs(t *testing.T) {
|
|
entity := queryprocessor.Update{}
|
|
|
|
assert.Nil(t, entity.GetRequiredQueryIDs())
|
|
|
|
ids := []uuid.UUID{uuid.New()}
|
|
entity.RequiredQueryIDs = &ids
|
|
assert.NotNil(t, entity.GetRequiredQueryIDs())
|
|
assert.Equal(t, ids, *entity.GetRequiredQueryIDs())
|
|
}
|
|
|
|
func TestUpdateSetRequiredQueryIDs(t *testing.T) {
|
|
entity := queryprocessor.Update{}
|
|
|
|
assert.Nil(t, entity.RequiredQueryIDs)
|
|
|
|
ids := []uuid.UUID{uuid.New()}
|
|
entity.SetRequiredQueryIDs(&ids)
|
|
assert.Equal(t, ids, *entity.RequiredQueryIDs)
|
|
}
|