Fixes issue #51

This commit is contained in:
2025-06-18 00:04:10 +01:00
parent cd307f88a1
commit e23135ded0
3 changed files with 276 additions and 7 deletions
+19 -6
View File
@@ -7,6 +7,19 @@ import (
"testing"
)
// Helper function to compare string slices
func equalSlices(a, b []string) bool {
if len(a) != len(b) {
return false
}
for i, v := range a {
if v != b[i] {
return false
}
}
return true
}
func TestCreateConfig(t *testing.T) {
t.Run("Default Values", func(t *testing.T) {
config := CreateConfig()
@@ -38,25 +51,25 @@ func TestCreateConfig(t *testing.T) {
}
})
t.Run("Custom Values Preserved", func(t *testing.T) {
t.Run("Config Can Hold Custom Values", func(t *testing.T) {
config := CreateConfig()
config.Scopes = []string{"custom_scope"}
config.LogLevel = "debug"
config.RateLimit = 50
config.ForceHTTPS = false
// Verify custom values are not overwritten
// Verify config struct can hold custom values
if len(config.Scopes) != 1 || config.Scopes[0] != "custom_scope" {
t.Error("Custom scopes were overwritten")
t.Error("Config struct cannot hold custom scopes")
}
if config.LogLevel != "debug" {
t.Error("Custom log level was overwritten")
t.Error("Config struct cannot hold custom log level")
}
if config.RateLimit != 50 {
t.Error("Custom rate limit was overwritten")
t.Error("Config struct cannot hold custom rate limit")
}
if config.ForceHTTPS {
t.Error("Custom ForceHTTPS value was overwritten")
t.Error("Config struct cannot hold custom ForceHTTPS value")
}
})
}