Quellcodebibliothek Statistik Leitseite products/Sources/formale Sprachen/JAVA/Openclaw/src/infra/outbound/   (KI Agentensystem Version 22©)  Datei vom 26.3.2026 mit Größe 2 kB image not shown  

Quelle  conversation-id.test.ts

  Sprache: JAVA
 

Spracherkennung für: .ts vermutete Sprache: Unknown {[0] [0] [0]} [Methode: Schwerpunktbildung, einfache Gewichte, sechs Dimensionen]

import { describe, expect, it } from "vitest";
import { resolveConversationIdFromTargets } from "./conversation-id.js";

describe("resolveConversationIdFromTargets", () => {
  it.each([
    {
      name: "prefers explicit thread id strings",
      params: { threadId: "123456789", targets: ["channel:987654321"] },
      expected: "123456789",
    },
    {
      name: "normalizes numeric thread ids",
      params: { threadId: 123456789, targets: ["channel:987654321"] },
      expected: "123456789",
    },
    {
      name: "falls back when the thread id is blank",
      params: { threadId: "   ", targets: ["channel:987654321"] },
      expected: "987654321",
    },
  ])("$name", ({ params, expected }) => {
    expect(resolveConversationIdFromTargets(params)).toBe(expected);
  });

  it.each([
    {
      name: "extracts channel ids from channel targets",
      targets: ["channel:987654321"],
      expected: "987654321",
    },
    {
      name: "trims channel target ids",
      targets: ["channel: 987654321 "],
      expected: "987654321",
    },
    {
      name: "extracts room ids from Matrix room targets",
      targets: ["room:!room:example.org"],
      expected: "!room:example.org",
    },
    {
      name: "extracts ids from explicit conversation targets",
      targets: ["conversation:19:abc@thread.tacv2"],
      expected: "19:abc@thread.tacv2",
    },
    {
      name: "extracts ids from explicit group targets",
      targets: ["group:1471383327500481391"],
      expected: "1471383327500481391",
    },
    {
      name: "extracts ids from explicit dm targets",
      targets: ["dm:alice"],
      expected: "alice",
    },
    {
      name: "extracts ids from Discord channel mentions",
      targets: ["<#1475250310120214812>"],
      expected: "1475250310120214812",
    },
    {
      name: "accepts raw numeric ids",
      targets: ["1475250310120214812"],
      expected: "1475250310120214812",
    },
    {
      name: "returns undefined for non-channel targets",
      targets: ["user:alice", "general"],
      expected: undefined,
    },
    {
      name: "skips blank and malformed targets",
      targets: [undefined, null, "   ", "channel:  ", "<#not-a-number>"],
      expected: undefined,
    },
  ])("$name", ({ targets, expected }) => {
    expect(resolveConversationIdFromTargets({ targets })).toBe(expected);
  });
});

¤ Dauer der Verarbeitung: 0.12 Sekunden  (vorverarbeitet am  2026-04-27) ¤

*© Formatika GbR, Deutschland






Wurzel

Suchen

Beweissystem der NASA

Beweissystem Isabelle

NIST Cobol Testsuite

Cephes Mathematical Library

Wiener Entwicklungsmethode

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.