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


Quelle  reply-inline.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 { extractInlineSimpleCommand, stripInlineStatus } from "./reply-inline.js";

describe("stripInlineStatus", () => {
  it("strips /status directive from message", () => {
    const result = stripInlineStatus("/status hello world");
    expect(result.cleaned).toBe("hello world");
    expect(result.didStrip).toBe(true);
  });

  it("preserves newlines in multi-line messages", () => {
    const result = stripInlineStatus("first line\nsecond line\nthird line");
    expect(result.cleaned).toBe("first line\nsecond line\nthird line");
    expect(result.didStrip).toBe(false);
  });

  it("preserves newlines when stripping /status", () => {
    const result = stripInlineStatus("/status\nfirst paragraph\n\nsecond paragraph");
    expect(result.cleaned).toBe("first paragraph\n\nsecond paragraph");
    expect(result.didStrip).toBe(true);
  });

  it("collapses horizontal whitespace but keeps newlines", () => {
    const result = stripInlineStatus("hello   world\n  indented  line");
    expect(result.cleaned).toBe("hello world\n indented line");
    // didStrip is true because whitespace normalization changed the string
    expect(result.didStrip).toBe(true);
  });

  it("returns empty string for whitespace-only input", () => {
    const result = stripInlineStatus("   ");
    expect(result.cleaned).toBe("");
    expect(result.didStrip).toBe(false);
  });
});

describe("extractInlineSimpleCommand", () => {
  it("extracts /help command", () => {
    const result = extractInlineSimpleCommand("/help some question");
    expect(result?.command).toBe("/help");
    expect(result?.cleaned).toBe("some question");
  });

  it("preserves newlines after extracting command", () => {
    const result = extractInlineSimpleCommand("/help first line\nsecond line");
    expect(result?.command).toBe("/help");
    expect(result?.cleaned).toBe("first line\nsecond line");
  });

  it("returns null for empty body", () => {
    expect(extractInlineSimpleCommand("")).toBeNull();
    expect(extractInlineSimpleCommand(undefined)).toBeNull();
  });
});

¤ 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.






                                                                                                                                                                                                                                                                                                                                                                                                     


Neuigkeiten

     Aktuelles
     Motto des Tages

Software

     Produkte
     Quellcodebibliothek

Aktivitäten

     Artikel über Sicherheit
     Anleitung zur Aktivierung von SSL

Muße

     Gedichte
     Musik
     Bilder

Jenseits des Üblichen ....

Besucherstatistik

Besucherstatistik

Monitoring

Montastic status badge