@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 04:45 UTC

main
ts 36 lines 1.66 KB
Raw
1 import { describe, expect, it } from "vite-plus/test";
2
3 import { describePullRequestDiffError } from "./pullRequestDiffError";
4
5 describe("describePullRequestDiffError", () => {
6 it("explains the rate limit inside an HTTP transport error without exposing the endpoint", () => {
7 const error =
8 "Failed to fetch remote environment endpoint http://127.0.0.1:49477/api/pull-requests/diff (PullRequestOperationError: Pull request operation diff failed: github requests to github.com are paused until the rate limit resets.).";
9 const result = describePullRequestDiffError(error, "GitHub", "pr");
10
11 expect(result.title).toBe("GitHub rate limit reached");
12 expect(result.description).toContain("after the limit resets");
13 expect(result.description).not.toContain("127.0.0.1");
14 expect(result.description).not.toContain("PullRequestOperationError");
15 });
16
17 // regression: #19945 diff load failures from a provider quota showed a generic error
18 it("recognizes a provider's API quota error", () => {
19 expect(
20 describePullRequestDiffError("GitHub API rate limit exceeded.", "GitHub", "pr").title,
21 ).toBe("GitHub rate limit reached");
22 });
23
24 it("does not blame a rate limit for an unknown connection failure", () => {
25 const result = describePullRequestDiffError(
26 "Failed to fetch remote environment endpoint http://localhost:49477/api/pull-requests/diff (TypeError: Failed to fetch).",
27 "GitHub",
28 "pr",
29 );
30
31 expect(result.title).toBe("Couldn't load the changes");
32 expect(result.description).toContain("Try again");
33 expect(result.description).not.toContain("localhost");
34 expect(result.description).not.toContain("limit");
35 });
36 });