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

Function TestValidateAliasKey

pkg/workflow/model_alias_validation_test.go:254–277  ·  view source on GitHub ↗

─── V-MAF-005: alias key validation ─────────────────────────────────────────

(t *testing.T)

Source from the content-addressed store, hash-verified

252// ─── V-MAF-005: alias key validation ─────────────────────────────────────────
253
254func TestValidateAliasKey(t *testing.T) {
255 tests := []struct {
256 key string
257 wantErr bool
258 }{
259 {"sonnet", false},
260 {"my-alias", false},
261 {"", false}, // empty string = default policy, always allowed
262 {"a/b", true}, // V-MAF-005: slash
263 {"a?b", true}, // V-MAF-005: question mark
264 {"a&b", true}, // V-MAF-005: ampersand
265 }
266 for _, tt := range tests {
267 t.Run(tt.key, func(t *testing.T) {
268 err := validateAliasKey(tt.key, "/fake/path.md")
269 if tt.wantErr {
270 require.Error(t, err, "alias key %q should fail validation (V-MAF-005)", tt.key)
271 assert.Contains(t, err.Error(), "V-MAF-005", "error should reference V-MAF-005")
272 } else {
273 assert.NoError(t, err, "alias key %q should pass validation", tt.key)
274 }
275 })
276 }
277}
278
279// ─── V-MAF-010: circular alias detection ─────────────────────────────────────
280

Callers

nothing calls this directly

Calls 3

validateAliasKeyFunction · 0.85
RunMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected