mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 12:31:23 +00:00
- Fix code-size -> code-analysis job name (5 jobs had wrong dependency) - Remove useless install-check job (was no-op) - Add explicit docs_only guard to release-check - Remove dead submodule checkout steps (no submodules in repo) - Rename detect-docs-only -> detect-docs-changes, add docs_changed output - Reorder check script: format first for faster fail - Fix billing error test (PR #12946 removed fallback detection but not test)
31 lines
1.0 KiB
TypeScript
31 lines
1.0 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { isBillingErrorMessage } from "./pi-embedded-helpers.js";
|
|
import { DEFAULT_AGENTS_FILENAME } from "./workspace.js";
|
|
|
|
const _makeFile = (overrides: Partial<WorkspaceBootstrapFile>): WorkspaceBootstrapFile => ({
|
|
name: DEFAULT_AGENTS_FILENAME,
|
|
path: "/tmp/AGENTS.md",
|
|
content: "",
|
|
missing: false,
|
|
...overrides,
|
|
});
|
|
describe("isBillingErrorMessage", () => {
|
|
it("matches credit / payment failures", () => {
|
|
const samples = [
|
|
"Your credit balance is too low to access the Anthropic API.",
|
|
"insufficient credits",
|
|
"Payment Required",
|
|
"HTTP 402 Payment Required",
|
|
"plans & billing",
|
|
];
|
|
for (const sample of samples) {
|
|
expect(isBillingErrorMessage(sample)).toBe(true);
|
|
}
|
|
});
|
|
it("ignores unrelated errors", () => {
|
|
expect(isBillingErrorMessage("rate limit exceeded")).toBe(false);
|
|
expect(isBillingErrorMessage("invalid api key")).toBe(false);
|
|
expect(isBillingErrorMessage("context length exceeded")).toBe(false);
|
|
});
|
|
});
|