Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/JAVA/Openclaw/extensions/whatsapp/src/   (Openclaw AI Version 22©)  Datei vom 26.3.2026 mit Größe 1 kB image not shown  

Quelle  group-session-key.test.ts

  Sprache: JAVA
 

import { describe, expect, it } from "vitest";
import { resolveWhatsAppGroupSessionRoute, __testing } from "./group-session-key.js";

describe("resolveWhatsAppGroupSessionRoute", () => {
  it("keeps default-account group routes unchanged", () => {
    const route = {
      agentId: "main",
      channel: "whatsapp",
      accountId: "default",
      sessionKey: "agent:main:whatsapp:group:123@g.us",
      mainSessionKey: "agent:main:main",
      lastRoutePolicy: "session",
      matchedBy: "default",
    } as const;

    expect(resolveWhatsAppGroupSessionRoute(route)).toEqual(route);
  });

  it("scopes named-account group routes through an account-specific thread suffix", () => {
    const route = {
      agentId: "main",
      channel: "whatsapp",
      accountId: "work",
      sessionKey: "agent:main:whatsapp:group:123@g.us",
      mainSessionKey: "agent:main:main",
      lastRoutePolicy: "session",
      matchedBy: "default",
    } as const;

    expect(resolveWhatsAppGroupSessionRoute(route)).toEqual({
      ...route,
      sessionKey: "agent:main:whatsapp:group:123@g.us:thread:whatsapp-account-work",
    });
  });

  it("derives the legacy group session key from a named-account scoped group route", () => {
    expect(
      __testing.resolveWhatsAppLegacyGroupSessionKey({
        accountId: "work",
        sessionKey: "agent:main:whatsapp:group:123@g.us:thread:whatsapp-account-work",
      }),
    ).toBe("agent:main:whatsapp:group:123@g.us");
  });

  it("normalizes mixed-case account ids when resolving legacy scoped group keys", () => {
    expect(
      __testing.resolveWhatsAppLegacyGroupSessionKey({
        accountId: "Work",
        sessionKey: "agent:main:whatsapp:group:123@g.us:thread:whatsapp-account-work",
      }),
    ).toBe("agent:main:whatsapp:group:123@g.us");
  });
});

Messung V0.5 in Prozent
C=94 H=86 G=89

¤ Dauer der Verarbeitung: 0.8 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.