TestSpec_PublicAPI_ValidateCopilotPAT validates the documented behavior of ValidateCopilotPAT as described in the package README.md. Specification: "Returns nil if the token is a fine-grained PAT; returns an actionable error message with a link to create the correct token type otherwise."
(t *testing.T)
| 713 | // Specification: "Returns nil if the token is a fine-grained PAT; returns an |
| 714 | // actionable error message with a link to create the correct token type otherwise." |
| 715 | func TestSpec_PublicAPI_ValidateCopilotPAT(t *testing.T) { |
| 716 | t.Run("fine-grained PAT returns nil", func(t *testing.T) { |
| 717 | err := ValidateCopilotPAT("github_pat_validtokenhere") |
| 718 | assert.NoError(t, err, |
| 719 | "ValidateCopilotPAT should return nil for fine-grained PAT") |
| 720 | }) |
| 721 | |
| 722 | t.Run("classic PAT returns actionable error", func(t *testing.T) { |
| 723 | err := ValidateCopilotPAT("ghp_classic_token") |
| 724 | require.Error(t, err, |
| 725 | "ValidateCopilotPAT should return an error for classic PAT") |
| 726 | assert.NotEmpty(t, err.Error(), |
| 727 | "ValidateCopilotPAT error should contain an actionable message") |
| 728 | }) |
| 729 | |
| 730 | t.Run("oauth token returns actionable error", func(t *testing.T) { |
| 731 | err := ValidateCopilotPAT("gho_oauth_token") |
| 732 | require.Error(t, err, |
| 733 | "ValidateCopilotPAT should return an error for OAuth token") |
| 734 | }) |
| 735 | } |
| 736 | |
| 737 | // TestSpec_PublicAPI_GetPATTypeDescription validates the documented behavior of |
| 738 | // GetPATTypeDescription as described in the package README.md. |
nothing calls this directly
no test coverage detected