(t *testing.T)
| 7 | ) |
| 8 | |
| 9 | func TestGetEffectiveGitHubToken(t *testing.T) { |
| 10 | tests := []struct { |
| 11 | name string |
| 12 | customToken string |
| 13 | expected string |
| 14 | }{ |
| 15 | { |
| 16 | name: "custom token has highest precedence", |
| 17 | customToken: "${{ secrets.CUSTOM_TOKEN }}", |
| 18 | expected: "${{ secrets.CUSTOM_TOKEN }}", |
| 19 | }, |
| 20 | { |
| 21 | name: "default fallback includes GH_AW_GITHUB_MCP_SERVER_TOKEN (for MCP and tools)", |
| 22 | customToken: "", |
| 23 | expected: "${{ secrets.GH_AW_GITHUB_MCP_SERVER_TOKEN || secrets.GH_AW_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}", |
| 24 | }, |
| 25 | } |
| 26 | |
| 27 | for _, tt := range tests { |
| 28 | t.Run(tt.name, func(t *testing.T) { |
| 29 | result := getEffectiveGitHubToken(tt.customToken) |
| 30 | if result != tt.expected { |
| 31 | t.Errorf("getEffectiveGitHubToken() = %q, want %q", result, tt.expected) |
| 32 | } |
| 33 | }) |
| 34 | } |
| 35 | } |
| 36 | |
| 37 | func TestGetEffectiveSafeOutputGitHubToken(t *testing.T) { |
| 38 | tests := []struct { |
nothing calls this directly
no test coverage detected