Files
multica/server/internal/integrations/telegram/install_error_test.go
603519d158 MUL-6977: test: remove implementation-only coverage (#7932)
* test: remove implementation-only coverage

Co-authored-by: multica-agent <[email protected]>

* test: remove remaining implementation-only coverage

Co-authored-by: multica-agent <[email protected]>

* test: restore compatibility and fragment navigation coverage

Co-authored-by: multica-agent <[email protected]>

* test: preserve behavioral cleanup contracts

Co-authored-by: multica-agent <[email protected]>

---------

Co-authored-by: Sol-Boy <[email protected]>
Co-authored-by: multica-agent <[email protected]>
2026-09-03 13:23:25 +08:00

45 lines
1.1 KiB
Go

package telegram
import (
"errors"
"net/http"
"testing"
)
func TestClassifyCredentialVerificationError(t *testing.T) {
tests := []struct {
name string
err error
want error
}{
{
name: "Telegram rejects the token",
err: &apiError{Code: http.StatusUnauthorized, Description: "Unauthorized"},
want: ErrCredentialsRejected,
},
{
name: "Telegram rate limits verification",
err: &apiError{Code: http.StatusTooManyRequests, Description: "Too Many Requests"},
want: ErrCredentialsUnverifiable,
},
{
name: "transport cannot reach Telegram",
err: &requestError{method: "getMe", cause: errors.New("proxy connect failed")},
want: ErrCredentialsUnverifiable,
},
{
name: "malformed upstream response",
err: errors.New("decode response"),
want: ErrCredentialsUnverifiable,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if err := classifyCredentialVerificationError(tt.err); !errors.Is(err, tt.want) {
t.Fatalf("classifyCredentialVerificationError() = %v, want %v", err, tt.want)
}
})
}
}