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

Function TestCombineTokenExpressions

pkg/workflow/github_token_test.go:149–178  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

147}
148
149func TestCombineTokenExpressions(t *testing.T) {
150 tests := []struct {
151 name string
152 primary string
153 fallback string
154 expected string
155 }{
156 {
157 name: "combines wrapped expressions",
158 primary: "${{ steps.safe-outputs-app-token.outputs.token }}",
159 fallback: "${{ secrets.GITHUB_TOKEN }}",
160 expected: "${{ steps.safe-outputs-app-token.outputs.token || secrets.GITHUB_TOKEN }}",
161 },
162 {
163 name: "trims whitespace and unwrapped expressions",
164 primary: " steps.safe-outputs-app-token.outputs.token ",
165 fallback: " secrets.GITHUB_TOKEN ",
166 expected: "${{ steps.safe-outputs-app-token.outputs.token || secrets.GITHUB_TOKEN }}",
167 },
168 }
169
170 for _, tt := range tests {
171 t.Run(tt.name, func(t *testing.T) {
172 result := combineTokenExpressions(tt.primary, tt.fallback)
173 if result != tt.expected {
174 t.Errorf("combineTokenExpressions() = %q, want %q", result, tt.expected)
175 }
176 })
177 }
178}

Callers

nothing calls this directly

Calls 3

combineTokenExpressionsFunction · 0.85
RunMethod · 0.45
ErrorfMethod · 0.45

Tested by

no test coverage detected