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

Quelle  doctor-cron-legacy-delivery.test.ts

  Sprache: JAVA
 

import { describe, expect, it } from "vitest";
import {
  buildDeliveryFromLegacyPayload,
  buildDeliveryPatchFromLegacyPayload,
  hasLegacyDeliveryHints,
  mergeLegacyDeliveryInto,
  normalizeLegacyDeliveryInput,
} from "./doctor-cron-legacy-delivery.js";

describe("legacy delivery threadId support", () => {
  it("treats threadId as a legacy delivery hint", () => {
    expect(hasLegacyDeliveryHints({ threadId: "42" })).toBe(true);
    expect(hasLegacyDeliveryHints({ threadId: 42 })).toBe(true);
  });

  it("hydrates threadId into new delivery payloads", () => {
    expect(
      buildDeliveryFromLegacyPayload({
        channel: "telegram",
        to: "-100123:topic:42",
        threadId: 42,
      }),
    ).toEqual({
      mode: "announce",
      channel: "telegram",
      to: "-100123:topic:42",
      threadId: "42",
    });
  });

  it("patches and merges threadId into existing deliveries", () => {
    expect(buildDeliveryPatchFromLegacyPayload({ threadId: "77" })).toEqual({
      mode: "announce",
      threadId: "77",
    });

    expect(
      mergeLegacyDeliveryInto(
        { mode: "announce", channel: "telegram", to: "-100123", threadId: "1" },
        { threadId: 77 },
      ),
    ).toEqual({
      delivery: { mode: "announce", channel: "telegram", to: "-100123", threadId: "77" },
      mutated: true,
    });
  });

  it("strips threadId from legacy payloads after normalization", () => {
    const payload: Record<string, unknown> = {
      channel: "telegram",
      to: "-100123:topic:42",
      threadId: 42,
    };

    expect(normalizeLegacyDeliveryInput({ payload })).toEqual({
      delivery: {
        mode: "announce",
        channel: "telegram",
        to: "-100123:topic:42",
        threadId: "42",
      },
      mutated: true,
    });
    expect(payload.threadId).toBeUndefined();
  });
});

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

¤ Dauer der Verarbeitung: 0.10 Sekunden  (vorverarbeitet am  2026-06-10) ¤

*© 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.