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

Function TestSpec_PublicAPI_FormatCacheKey

pkg/actionpins/spec_test.go:51–78  ·  view source on GitHub ↗

TestSpec_PublicAPI_FormatCacheKey validates the documented format "repo@version".

(t *testing.T)

Source from the content-addressed store, hash-verified

49
50// TestSpec_PublicAPI_FormatCacheKey validates the documented format "repo@version".
51func TestSpec_PublicAPI_FormatCacheKey(t *testing.T) {
52 tests := []struct {
53 name string
54 repo string
55 version string
56 expected string
57 }{
58 {
59 name: "formats cache key as repo@version",
60 repo: "actions/checkout",
61 version: "v4",
62 expected: "actions/checkout@v4",
63 },
64 {
65 name: "formats cache key with full semver",
66 repo: "actions/setup-node",
67 version: "v3.0.0",
68 expected: "actions/setup-node@v3.0.0",
69 },
70 }
71
72 for _, tt := range tests {
73 t.Run(tt.name, func(t *testing.T) {
74 result := actionpins.FormatCacheKey(tt.repo, tt.version)
75 assert.Equal(t, tt.expected, result, "FormatCacheKey(%q, %q) should match spec format", tt.repo, tt.version)
76 })
77 }
78}
79
80// TestSpec_PublicAPI_ExtractRepo validates extracting the repository from a uses reference.
81func TestSpec_PublicAPI_ExtractRepo(t *testing.T) {

Callers

nothing calls this directly

Calls 2

FormatCacheKeyFunction · 0.92
RunMethod · 0.45

Tested by

no test coverage detected