(t *testing.T)
| 147 | } |
| 148 | |
| 149 | func 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 | } |
nothing calls this directly
no test coverage detected