chore: use interfaces for all other services

This commit is contained in:
Christoph Haas
2025-03-23 23:09:47 +01:00
parent 02ed7b19df
commit 7d0da4e7ad
40 changed files with 1337 additions and 406 deletions

View File

@@ -0,0 +1,42 @@
package domain
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestConfigOption_GetValueReturnsCorrectValue(t *testing.T) {
option := ConfigOption[int]{Value: 42}
assert.Equal(t, 42, option.GetValue())
}
func TestConfigOption_SetValueUpdatesValue(t *testing.T) {
option := ConfigOption[int]{Value: 42}
option.SetValue(100)
assert.Equal(t, 100, option.GetValue())
}
func TestConfigOption_TrySetValueUpdatesValueWhenOverridable(t *testing.T) {
option := ConfigOption[int]{Value: 42, Overridable: true}
result := option.TrySetValue(100)
assert.True(t, result)
assert.Equal(t, 100, option.GetValue())
}
func TestConfigOption_TrySetValueDoesNotUpdateValueWhenNotOverridable(t *testing.T) {
option := ConfigOption[int]{Value: 42, Overridable: false}
result := option.TrySetValue(100)
assert.False(t, result)
assert.Equal(t, 42, option.GetValue())
}
func TestNewConfigOptionCreatesCorrectOption(t *testing.T) {
option := NewConfigOption(42, true)
assert.Equal(t, 42, option.GetValue())
assert.True(t, option.Overridable)
option2 := NewConfigOption("str", false)
assert.Equal(t, "str", option2.GetValue())
assert.False(t, option2.Overridable)
}