2025-01-29 11:52:37 +00:00
|
|
|
package resultprocessor_test
|
2025-01-20 13:31:48 +00:00
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"testing"
|
|
|
|
|
|
2025-03-05 12:05:46 +00:00
|
|
|
resultprocessor "queryorchestration/internal/query/result/processor"
|
|
|
|
|
|
2025-01-20 13:31:48 +00:00
|
|
|
"github.com/google/uuid"
|
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
func TestCreateGetConfig(t *testing.T) {
|
2025-01-29 11:52:37 +00:00
|
|
|
entity := resultprocessor.Create{}
|
2025-01-20 13:31:48 +00:00
|
|
|
|
|
|
|
|
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) {
|
2025-01-29 11:52:37 +00:00
|
|
|
entity := resultprocessor.Create{}
|
2025-01-20 13:31:48 +00:00
|
|
|
|
|
|
|
|
assert.Nil(t, entity.Config)
|
|
|
|
|
|
|
|
|
|
cfg := "example_config"
|
|
|
|
|
entity.SetConfig(&cfg)
|
|
|
|
|
assert.Equal(t, cfg, *entity.Config)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestUpdateGetConfig(t *testing.T) {
|
2025-01-29 11:52:37 +00:00
|
|
|
entity := resultprocessor.Update{}
|
2025-01-20 13:31:48 +00:00
|
|
|
|
|
|
|
|
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) {
|
2025-01-29 11:52:37 +00:00
|
|
|
entity := resultprocessor.Update{}
|
2025-01-20 13:31:48 +00:00
|
|
|
|
|
|
|
|
assert.Nil(t, entity.Config)
|
|
|
|
|
|
|
|
|
|
cfg := "example_config"
|
|
|
|
|
entity.SetConfig(&cfg)
|
|
|
|
|
assert.Equal(t, cfg, *entity.Config)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestCreateGetRequiredQueryIDs(t *testing.T) {
|
2025-01-29 11:52:37 +00:00
|
|
|
entity := resultprocessor.Create{}
|
2025-01-20 13:31:48 +00:00
|
|
|
|
|
|
|
|
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) {
|
2025-01-29 11:52:37 +00:00
|
|
|
entity := resultprocessor.Create{}
|
2025-01-20 13:31:48 +00:00
|
|
|
|
|
|
|
|
assert.Nil(t, entity.RequiredQueryIDs)
|
|
|
|
|
|
|
|
|
|
ids := []uuid.UUID{uuid.New()}
|
|
|
|
|
entity.SetRequiredQueryIDs(&ids)
|
|
|
|
|
assert.Equal(t, ids, *entity.RequiredQueryIDs)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func TestUpdateGetRequiredQueryIDs(t *testing.T) {
|
2025-01-29 11:52:37 +00:00
|
|
|
entity := resultprocessor.Update{}
|
2025-01-20 13:31:48 +00:00
|
|
|
|
|
|
|
|
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) {
|
2025-01-29 11:52:37 +00:00
|
|
|
entity := resultprocessor.Update{}
|
2025-01-20 13:31:48 +00:00
|
|
|
|
|
|
|
|
assert.Nil(t, entity.RequiredQueryIDs)
|
|
|
|
|
|
|
|
|
|
ids := []uuid.UUID{uuid.New()}
|
|
|
|
|
entity.SetRequiredQueryIDs(&ids)
|
|
|
|
|
assert.Equal(t, ids, *entity.RequiredQueryIDs)
|
|
|
|
|
}
|