package dbx import ( "testing" "time" ) func TestApplyOptions(t *testing.T) { cfg := Config{} logger := nopLogger{} metrics := &MetricsHook{} retry := RetryConfig{MaxAttempts: 7} hc := HealthCheckConfig{Interval: 10 * time.Second} ApplyOptions(&cfg, WithLogger(logger), WithMetrics(metrics), WithRetry(retry), WithHealthCheck(hc), ) if cfg.Logger == nil { t.Error("Logger should be set") } if cfg.Metrics == nil { t.Error("Metrics should be set") } if cfg.Retry.MaxAttempts != 7 { t.Errorf("Retry.MaxAttempts = %d, want 7", cfg.Retry.MaxAttempts) } if cfg.HealthCheck.Interval != 10*time.Second { t.Errorf("HealthCheck.Interval = %v, want 10s", cfg.HealthCheck.Interval) } }