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

Function TestIsPolicyCheck

pkg/cli/checks_command_test.go:156–205  ·  view source on GitHub ↗

--------------------------------------------------------------------------- isPolicyCheck – pattern matching tests ---------------------------------------------------------------------------

(t *testing.T)

Source from the content-addressed store, hash-verified

154// ---------------------------------------------------------------------------
155
156func TestIsPolicyCheck(t *testing.T) {
157 tests := []struct {
158 name string
159 checkName string
160 expected bool
161 }{
162 {
163 name: "branch protection pattern",
164 checkName: "Branch protection rule check",
165 expected: true,
166 },
167 {
168 name: "required status check pattern",
169 checkName: "Required status check",
170 expected: true,
171 },
172 {
173 name: "mergeability pattern",
174 checkName: "Mergeability check",
175 expected: true,
176 },
177 {
178 name: "policy check pattern",
179 checkName: "policy check for org",
180 expected: true,
181 },
182 {
183 name: "normal test run",
184 checkName: "unit tests",
185 expected: false,
186 },
187 {
188 name: "build check",
189 checkName: "build / linux",
190 expected: false,
191 },
192 {
193 name: "empty string",
194 checkName: "",
195 expected: false,
196 },
197 }
198
199 for _, tt := range tests {
200 t.Run(tt.name, func(t *testing.T) {
201 got := isPolicyCheck(tt.checkName)
202 assert.Equal(t, tt.expected, got, "isPolicyCheck(%q) should return %v", tt.checkName, tt.expected)
203 })
204 }
205}
206
207// ---------------------------------------------------------------------------
208// NewChecksCommand – command shape tests

Callers

nothing calls this directly

Calls 2

isPolicyCheckFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected