Eine aufbereitete Darstellung der Quelle

 
     
 
 
Anforderungen  |   Konzepte  |   Entwurf  |   Entwicklung  |   Qualitätssicherung  |   Lebenszyklus  |   Steuerung
 
 
 
 

Benutzer

Quelle  doctor-auth.hints.test.ts

  Sprache: JAVA
 

import { describe, expect, it } from "vitest";
import { formatOAuthRefreshFailureDoctorLine, resolveUnusableProfileHint } from "./doctor-auth.js";

describe("resolveUnusableProfileHint", () => {
  it("returns billing guidance for disabled billing profiles", () => {
    expect(resolveUnusableProfileHint({ kind: "disabled", reason: "billing" })).toBe(
      "Top up credits (provider billing) or switch provider.",
    );
  });

  it("returns credential guidance for permanent auth disables", () => {
    expect(resolveUnusableProfileHint({ kind: "disabled", reason: "auth_permanent" })).toBe(
      "Refresh or replace credentials, then retry.",
    );
  });

  it("falls back to cooldown guidance for non-billing disable reasons", () => {
    expect(resolveUnusableProfileHint({ kind: "disabled", reason: "unknown" })).toBe(
      "Wait for cooldown or switch provider.",
    );
  });

  it("returns cooldown guidance for cooldown windows", () => {
    expect(resolveUnusableProfileHint({ kind: "cooldown" })).toBe(
      "Wait for cooldown or switch provider.",
    );
  });

  it("formats permanent OAuth refresh failures as reauth-required", () => {
    expect(
      formatOAuthRefreshFailureDoctorLine({
        profileId: "openai-codex:default",
        provider: "openai-codex",
        message:
          "OAuth token refresh failed for openai-codex: refresh_token_reused. Please try again or re-authenticate.",
      }),
    ).toBe(
      "- openai-codex:default: re-auth required [refresh_token_reused] — Run `openclaw models auth login --provider openai-codex`.",
    );
  });

  it("formats non-permanent OAuth refresh failures as retry-then-reauth guidance", () => {
    expect(
      formatOAuthRefreshFailureDoctorLine({
        profileId: "openai-codex:default",
        provider: "openai-codex",
        message:
          "OAuth token refresh failed for openai-codex: temporary upstream issue. Please try again or re-authenticate.",
      }),
    ).toBe(
      "- openai-codex:default: OAuth refresh failed — Try again; if this persists, run `openclaw models auth login --provider openai-codex`.",
    );
  });

  it("drops the provider-specific command when the parsed provider is unsafe", () => {
    expect(
      formatOAuthRefreshFailureDoctorLine({
        profileId: "openai-codex:default",
        provider: "openai-codex",
        message:
          "OAuth token refresh failed for openai-codex`\nrm -rf /: invalid_grant. Please try again or re-authenticate.",
      }),
    ).toBe(
      "- openai-codex:default: re-auth required [invalid_grant] — Run `openclaw models auth login --provider openai-codex`.",
    );
  });
});

Messung V0.5 in Prozent
C=100 H=100 G=100

¤ Dauer der Verarbeitung: 0.9 Sekunden  (vorverarbeitet am  2026-06-05) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

PVS Prover

Isabelle Prover

NIST Cobol Testsuite

Cephes Mathematical Library

Vienna Development Method

Haftungshinweis

Die Informationen auf dieser Webseite wurden nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit, noch Qualität der bereit gestellten Informationen zugesichert.

Bemerkung:

Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Quellcodebibliothek
     Eigene Quellcodes
     Fremde Quellcodes
     Suchen

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....
    

Besucherstatistik

Besucherstatistik