MCPcopy Create free account
hub / github.com/github/gh-aw / TestParseTriggerShorthand

Function TestParseTriggerShorthand

pkg/workflow/trigger_parser_test.go:9–311  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

7)
8
9func TestParseTriggerShorthand(t *testing.T) {
10 tests := []struct {
11 name string
12 input string
13 wantEvent string
14 wantTypes []string
15 wantFilters map[string]any
16 wantConds []string
17 wantNil bool
18 wantErr bool
19 }{
20 // Source Control Patterns - Push
21 {
22 name: "simple push (left as-is)",
23 input: "push",
24 wantNil: true, // Simple triggers left as-is
25 },
26 {
27 name: "push to branch",
28 input: "push to main",
29 wantEvent: "push",
30 wantFilters: map[string]any{
31 "branches": []string{"main"},
32 },
33 },
34 {
35 name: "push to branch with spaces",
36 input: "push to feature branch",
37 wantEvent: "push",
38 wantFilters: map[string]any{
39 "branches": []string{"feature branch"},
40 },
41 },
42 {
43 name: "push tags",
44 input: "push tags v*",
45 wantEvent: "push",
46 wantFilters: map[string]any{
47 "tags": []string{"v*"},
48 },
49 },
50
51 // Source Control Patterns - Pull Request
52 {
53 name: "simple pull_request (left as-is)",
54 input: "pull_request",
55 wantNil: true, // Simple triggers left as-is
56 },
57 {
58 name: "simple pull (left as-is)",
59 input: "pull",
60 wantNil: true, // Simple triggers left as-is
61 },
62 {
63 name: "pull_request opened",
64 input: "pull_request opened",
65 wantEvent: "pull_request",
66 wantTypes: []string{"opened"},

Callers

nothing calls this directly

Calls 5

ParseTriggerShorthandFunction · 0.85
slicesEqualFunction · 0.85
mapsEqualFunction · 0.70
RunMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected