add ability to set test kv properties

This commit is contained in:
Joel Wetzell
2026-05-20 17:26:21 -05:00
parent 00b03197c2
commit 849a59a63b
5 changed files with 34 additions and 18 deletions
+11 -3
View File
@@ -62,9 +62,10 @@ func (m *TestOutputModule) Id() string {
return m.id
}
func NewTestKVModule(id string) *TestKVModule {
func NewTestKVModule(id string, presetValues map[string]any) *TestKVModule {
return &TestKVModule{
id: id,
id: id,
kvData: presetValues,
}
}
@@ -89,7 +90,14 @@ func (m *TestKVModule) Id() string {
}
func (m *TestKVModule) Get(key string) (any, error) {
return key, nil
if m.kvData == nil {
return nil, nil
}
value, ok := m.kvData[key]
if !ok {
return nil, nil
}
return value, nil
}
func (m *TestKVModule) Set(key string, value any) error {