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

Function TestParseSourceSpec_Integration

pkg/cli/update_integration_test.go:365–406  ·  view source on GitHub ↗

--- ParseSourceSpec Integration Tests --- TestParseSourceSpec_Integration verifies source spec parsing for various formats.

(t *testing.T)

Source from the content-addressed store, hash-verified

363
364// TestParseSourceSpec_Integration verifies source spec parsing for various formats.
365func TestParseSourceSpec_Integration(t *testing.T) {
366 tests := []struct {
367 name string
368 source string
369 expectedRepo string
370 expectedPath string
371 expectedRef string
372 }{
373 {
374 name: "standard format with tag",
375 source: "github/gh-aw/.github/workflows/workflow.md@v1.2.3",
376 expectedRepo: "github/gh-aw",
377 expectedPath: ".github/workflows/workflow.md",
378 expectedRef: "v1.2.3",
379 },
380 {
381 name: "standard format with branch",
382 source: "githubnext/agentics/workflows/repo-assist.md@main",
383 expectedRepo: "githubnext/agentics",
384 expectedPath: "workflows/repo-assist.md",
385 expectedRef: "main",
386 },
387 {
388 name: "standard format with commit SHA",
389 source: "githubnext/agentics/workflows/repo-assist.md@6c79ed2ea350161ad5dcc9624cf510f134c6a9e3",
390 expectedRepo: "githubnext/agentics",
391 expectedPath: "workflows/repo-assist.md",
392 expectedRef: "6c79ed2ea350161ad5dcc9624cf510f134c6a9e3",
393 },
394 }
395
396 for _, tt := range tests {
397 t.Run(tt.name, func(t *testing.T) {
398 spec, err := parseSourceSpec(tt.source)
399 require.NoError(t, err, "Should parse source spec: %s", tt.source)
400
401 assert.Equal(t, tt.expectedRepo, spec.Repo, "Repo should match")
402 assert.Equal(t, tt.expectedPath, spec.Path, "Path should match")
403 assert.Equal(t, tt.expectedRef, spec.Ref, "Ref should match")
404 })
405 }
406}
407
408// TestIsCommitSHA_Integration tests commit SHA identification with real-world examples.
409func TestIsCommitSHA_Integration(t *testing.T) {

Callers

nothing calls this directly

Calls 2

parseSourceSpecFunction · 0.85
RunMethod · 0.45

Tested by

no test coverage detected