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

Function TestNormalizeProtocolMode

internal/validation/validation_test.go:9–40  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

7)
8
9func TestNormalizeProtocolMode(t *testing.T) {
10 tests := []struct {
11 name string
12 input string
13 want string
14 wantErr bool
15 }{
16 {name: "default", input: "", want: ProtocolAuto},
17 {name: "auto", input: ProtocolAuto, want: ProtocolAuto},
18 {name: "v1", input: ProtocolV1, want: ProtocolV1},
19 {name: "v2", input: ProtocolV2, want: ProtocolV2},
20 {name: "invalid", input: "v3", wantErr: true},
21 }
22
23 for _, tt := range tests {
24 t.Run(tt.name, func(t *testing.T) {
25 got, err := NormalizeProtocolMode(tt.input)
26 if tt.wantErr {
27 if err == nil {
28 t.Fatal("expected error")
29 }
30 return
31 }
32 if err != nil {
33 t.Fatalf("NormalizeProtocolMode: %v", err)
34 }
35 if got != tt.want {
36 t.Fatalf("NormalizeProtocolMode(%q) = %q, want %q", tt.input, got, tt.want)
37 }
38 })
39 }
40}
41
42func TestParseMapping(t *testing.T) {
43 tests := []struct {

Callers

nothing calls this directly

Calls 1

NormalizeProtocolModeFunction · 0.85

Tested by

no test coverage detected