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


Quelle  session-interaction-mode.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 {
  isParentOwnedBackgroundAcpSession,
  isRequesterParentOfBackgroundAcpSession,
  resolveAcpSessionInteractionMode,
} from "./session-interaction-mode.js";

const parentKey = "agent:main:main";
const otherKey = "agent:peer:some-other";

describe("resolveAcpSessionInteractionMode", () => {
  it("returns interactive when entry is undefined", () => {
    expect(resolveAcpSessionInteractionMode(undefined)).toBe("interactive");
  });

  it("returns interactive for non-oneshot ACP sessions", () => {
    expect(
      resolveAcpSessionInteractionMode({
        acp: { mode: "persistent" } as never,
        spawnedBy: parentKey,
      }),
    ).toBe("interactive");
  });

  it("returns parent-owned-background for oneshot sessions with spawnedBy set", () => {
    expect(
      resolveAcpSessionInteractionMode({
        acp: { mode: "oneshot" } as never,
        spawnedBy: parentKey,
      }),
    ).toBe("parent-owned-background");
  });

  it("returns parent-owned-background for oneshot sessions with parentSessionKey set", () => {
    expect(
      resolveAcpSessionInteractionMode({
        acp: { mode: "oneshot" } as never,
        parentSessionKey: parentKey,
      }),
    ).toBe("parent-owned-background");
  });

  it("returns interactive for a oneshot session without any parent linkage", () => {
    expect(
      resolveAcpSessionInteractionMode({
        acp: { mode: "oneshot" } as never,
      }),
    ).toBe("interactive");
  });
});

describe("isRequesterParentOfBackgroundAcpSession", () => {
  const backgroundEntry = {
    acp: { mode: "oneshot" } as never,
    spawnedBy: parentKey,
    parentSessionKey: parentKey,
  };

  it("returns true when requester matches spawnedBy", () => {
    expect(
      isRequesterParentOfBackgroundAcpSession(
        { acp: { mode: "oneshot" } as never, spawnedBy: parentKey },
        parentKey,
      ),
    ).toBe(true);
  });

  it("returns true when requester matches parentSessionKey", () => {
    expect(
      isRequesterParentOfBackgroundAcpSession(
        { acp: { mode: "oneshot" } as never, parentSessionKey: parentKey },
        parentKey,
      ),
    ).toBe(true);
  });

  it("returns false when requester is a different session (not the parent)", () => {
    expect(isRequesterParentOfBackgroundAcpSession(backgroundEntry, otherKey)).toBe(false);
  });

  it("returns false when requester key is missing", () => {
    expect(isRequesterParentOfBackgroundAcpSession(backgroundEntry, undefined)).toBe(false);
    expect(isRequesterParentOfBackgroundAcpSession(backgroundEntry, "")).toBe(false);
  });

  it("returns false when target is not a parent-owned background ACP session", () => {
    expect(
      isRequesterParentOfBackgroundAcpSession(
        { acp: { mode: "persistent" } as never, spawnedBy: parentKey },
        parentKey,
      ),
    ).toBe(false);
  });

  it("delegates to isParentOwnedBackgroundAcpSession for target-only checks", () => {
    expect(isParentOwnedBackgroundAcpSession(backgroundEntry)).toBe(true);
  });
});

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