MCPcopy Create free account
hub / github.com/entireio/git-sync / TestAdvancedOptionsValidate

Function TestAdvancedOptionsValidate

unstable/client_test.go:50–72  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

48}
49
50func TestAdvancedOptionsValidate(t *testing.T) {
51 t.Parallel()
52 cases := []struct {
53 name string
54 opts AdvancedOptions
55 wantErr bool
56 }{
57 {name: "empty strategy is the default", opts: AdvancedOptions{}, wantErr: false},
58 {name: "first-parent accepted", opts: AdvancedOptions{BootstrapStrategy: BootstrapStrategyFirstParent}, wantErr: false},
59 {name: "topo accepted", opts: AdvancedOptions{BootstrapStrategy: BootstrapStrategyTopo}, wantErr: false},
60 {name: "typo rejected at API edge", opts: AdvancedOptions{BootstrapStrategy: "topographic"}, wantErr: true},
61 {name: "case-sensitive: TOPO is not topo", opts: AdvancedOptions{BootstrapStrategy: "TOPO"}, wantErr: true},
62 }
63 for _, c := range cases {
64 t.Run(c.name, func(t *testing.T) {
65 t.Parallel()
66 err := c.opts.Validate()
67 if (err != nil) != c.wantErr {
68 t.Errorf("Validate() err=%v, wantErr=%v", err, c.wantErr)
69 }
70 })
71 }
72}
73
74func TestClientRejectsUnknownStrategyBeforeIO(t *testing.T) {
75 t.Parallel()

Callers

nothing calls this directly

Calls 1

ValidateMethod · 0.45

Tested by

no test coverage detected