Monorepo for Tangled tangled.org
3

Configure Feed

Select the types of activity you want to include in your feed.

core / spindle / server_test.go
1.2 kB 55 lines
1package spindle 2 3import ( 4 "testing" 5 6 kgit "tangled.org/core/knotserver/git" 7) 8 9func TestHasSkipCIPushOption(t *testing.T) { 10 tests := []struct { 11 name string 12 pushOptions []string 13 want bool 14 }{ 15 { 16 name: "skip-ci requests skip", 17 pushOptions: []string{"skip-ci"}, 18 want: true, 19 }, 20 { 21 name: "ci-skip requests skip", 22 pushOptions: []string{"ci-skip"}, 23 want: true, 24 }, 25 { 26 name: "unrelated ci options do not skip", 27 pushOptions: []string{"verbose-ci", "ci-verbose"}, 28 want: false, 29 }, 30 { 31 name: "empty options do not skip", 32 pushOptions: []string{}, 33 want: false, 34 }, 35 { 36 name: "nil options do not skip", 37 pushOptions: nil, 38 want: false, 39 }, 40 { 41 name: "mixed options skip when any skip option appears", 42 pushOptions: []string{"verbose-ci", "skip-ci", "ci-verbose"}, 43 want: true, 44 }, 45 } 46 47 for _, tt := range tests { 48 t.Run(tt.name, func(t *testing.T) { 49 got := kgit.HasSkipCIPushOption(tt.pushOptions) 50 if got != tt.want { 51 t.Fatalf("hasSkipCIPushOption(%v) = %v, want %v", tt.pushOptions, got, tt.want) 52 } 53 }) 54 } 55}