Skip to content

Fix banned user test to match new suspension message#520

Merged
jahooma merged 1 commit intomainfrom
jahooma/fix-banned-test
Apr 20, 2026
Merged

Fix banned user test to match new suspension message#520
jahooma merged 1 commit intomainfrom
jahooma/fix-banned-test

Conversation

@jahooma
Copy link
Copy Markdown
Contributor

@jahooma jahooma commented Apr 20, 2026

Summary

  • The banned-user response message in _post.ts was updated, but the test assertions still checked the old phrasing ("due to billing issues" / "to resolve this").
  • Updated completions.test.ts assertions to match the current message ("Your account has been suspended" / "if you did not expect this").
  • Updated the example in docs/error-schema.md to reflect the new message.

Test plan

  • CI: bun test web/src/app/api/v1/chat/completions/__tests__/completions.test.ts passes the "Banned users" case.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@jahooma jahooma merged commit 78740f5 into main Apr 20, 2026
11 checks passed
@jahooma jahooma deleted the jahooma/fix-banned-test branch April 20, 2026 00:33
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Apr 20, 2026

Greptile Summary

This PR syncs test assertions and documentation to match an already-shipped change to the account_suspended error message in _post.ts. The production code (_post.ts:263) already returns "Your account has been suspended. Please contact … if you did not expect this." — the test and docs just hadn't been updated yet.

  • completions.test.ts: Two toContain assertions updated from the old phrasing ("due to billing issues" / "to resolve this") to the new phrasing ("Your account has been suspended" / "if you did not expect this").
  • docs/error-schema.md: Example message in the error-schema table updated to the new phrasing.

Confidence Score: 5/5

Safe to merge — purely a test and documentation sync with no logic changes.

The production code was already correct; this PR only updates two test assertions and one documentation example to match it. There are no behavioral changes, no new logic, and no security implications.

No files require special attention.

Important Files Changed

Filename Overview
web/src/app/api/v1/chat/completions/tests/completions.test.ts Two test assertions updated to match the current suspension message; changes are correct and consistent with _post.ts.
docs/error-schema.md Example message in the error-schema table updated to reflect the new suspension wording.

Sequence Diagram

sequenceDiagram
    participant Client
    participant POST as _post.ts
    participant DB as User DB

    Client->>POST: POST /api/v1/chat/completions (API key)
    POST->>DB: Fetch user info (id, email, banned, ...)
    DB-->>POST: userInfo
    alt userInfo.banned === true
        POST-->>Client: 403 { error: "account_suspended", message: "Your account has been suspended..." }
    else not banned
        POST-->>Client: Continue with normal completion flow
    end
Loading

Reviews (1): Last reviewed commit: "Update banned user test assertions to ma..." | Re-trigger Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant