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

Quelle  welcome-card.test.ts

  Sprache: JAVA
 

import { describe, expect, it } from "vitest";
import { buildMSTeamsPresentationCard } from "./presentation.js";
import { buildGroupWelcomeText, buildWelcomeCard } from "./welcome-card.js";

describe("buildMSTeamsPresentationCard", () => {
  it("preserves message text when rendering presentation controls", () => {
    expect(
      buildMSTeamsPresentationCard({
        text: "Deploy finished",
        presentation: {
          blocks: [
            {
              type: "buttons",
              buttons: [{ label: "Open", value: "open" }],
            },
          ],
        },
      }),
    ).toEqual({
      type: "AdaptiveCard",
      version: "1.4",
      body: [{ type: "TextBlock", text: "Deploy finished", wrap: true }],
      actions: [{ type: "Action.Submit", title: "Open", data: { value: "open", label: "Open" } }],
    });
  });
});

describe("buildWelcomeCard", () => {
  it("builds card with default prompt starters", () => {
    const card = buildWelcomeCard();
    expect(card.type).toBe("AdaptiveCard");
    expect(card.version).toBe("1.5");

    const body = card.body as Array<{ text: string }>;
    expect(body[0]?.text).toContain("OpenClaw");

    const actions = card.actions as Array<{ title: string; data: unknown }>;
    expect(actions.length).toBe(3);
    expect(actions[0]?.title).toBe("What can you do?");
  });

  it("uses custom bot name", () => {
    const card = buildWelcomeCard({ botName: "TestBot" });
    const body = card.body as Array<{ text: string }>;
    expect(body[0]?.text).toContain("TestBot");
  });

  it("uses custom prompt starters", () => {
    const card = buildWelcomeCard({
      promptStarters: ["Do X""Do Y"],
    });
    const actions = card.actions as Array<{ title: string; data: unknown }>;
    expect(actions.length).toBe(2);
    expect(actions[0]?.title).toBe("Do X");
    expect(actions[1]?.title).toBe("Do Y");

    // Verify imBack data
    const data = actions[0]?.data as { msteams: { type: string; value: string } };
    expect(data.msteams.type).toBe("imBack");
    expect(data.msteams.value).toBe("Do X");
  });

  it("falls back to defaults when promptStarters is empty", () => {
    const card = buildWelcomeCard({ promptStarters: [] });
    const actions = card.actions as Array<{ title: string }>;
    expect(actions.length).toBe(3);
  });
});

describe("buildGroupWelcomeText", () => {
  it("includes bot name", () => {
    const text = buildGroupWelcomeText("MyBot");
    expect(text).toContain("MyBot");
    expect(text).toContain("@MyBot");
  });

  it("defaults to OpenClaw", () => {
    const text = buildGroupWelcomeText();
    expect(text).toContain("OpenClaw");
  });
});

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

¤ Dauer der Verarbeitung: 0.14 Sekunden  (vorverarbeitet am  2026-05-26) ¤

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