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

Function TestSetFieldInOnTrigger

pkg/cli/frontmatter_editor_test.go:119–214  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

117}
118
119func TestSetFieldInOnTrigger(t *testing.T) {
120 tests := []struct {
121 name string
122 content string
123 fieldName string
124 fieldValue string
125 shouldMatch string
126 expectError bool
127 }{
128 {
129 name: "set stop-after in existing on trigger",
130 content: `---
131on:
132 issues:
133 types: [opened]
134permissions:
135 contents: read
136---
137
138# Test Workflow`,
139 fieldName: "stop-after",
140 fieldValue: "+48h",
141 shouldMatch: "stop-after:",
142 expectError: false,
143 },
144 {
145 name: "set stop-after with no on field",
146 content: `---
147permissions:
148 contents: read
149---
150
151# Test Workflow`,
152 fieldName: "stop-after",
153 fieldValue: "+72h",
154 shouldMatch: "stop-after:",
155 expectError: false,
156 },
157 {
158 name: "override existing stop-after value",
159 content: `---
160on:
161 issues:
162 types: [opened]
163 stop-after: "+24h"
164permissions:
165 contents: read
166---
167
168# Test Workflow`,
169 fieldName: "stop-after",
170 fieldValue: "+96h",
171 shouldMatch: "stop-after:",
172 expectError: false,
173 },
174 {
175 name: "on field is a string not a map - error case",
176 content: `---

Callers

nothing calls this directly

Calls 3

SetFieldInOnTriggerFunction · 0.85
RunMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected