--- parseIDConfig tests ---
(t *testing.T)
| 749 | // --- parseIDConfig tests --- |
| 750 | |
| 751 | func TestParseIDConfig_FullConfig(t *testing.T) { |
| 752 | raw := map[string]any{ |
| 753 | "strategy": "prefixed", |
| 754 | "prefix": "dr", |
| 755 | "length": 6, |
| 756 | "padding": 3, |
| 757 | } |
| 758 | |
| 759 | cfg := parseIDConfig(raw) |
| 760 | if cfg == nil { |
| 761 | t.Fatal("expected non-nil IDConfig") |
| 762 | return |
| 763 | } |
| 764 | if cfg.Strategy != "prefixed" { |
| 765 | t.Errorf("Strategy = %q, want %q", cfg.Strategy, "prefixed") |
| 766 | } |
| 767 | if cfg.Prefix != "dr" { |
| 768 | t.Errorf("Prefix = %q, want %q", cfg.Prefix, "dr") |
| 769 | } |
| 770 | if cfg.Length != 6 { |
| 771 | t.Errorf("Length = %d, want 6", cfg.Length) |
| 772 | } |
| 773 | if cfg.Padding != 3 { |
| 774 | t.Errorf("Padding = %d, want 3", cfg.Padding) |
| 775 | } |
| 776 | } |
| 777 | |
| 778 | func TestParseIDConfig_PartialConfig(t *testing.T) { |
| 779 | raw := map[string]any{ |
nothing calls this directly
no test coverage detected