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

Quelle  startup-tasks.test.ts

  Sprache: JAVA
 

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

import { describe, expect, it, vi } from "vitest";
import { runStartupTasks, type StartupTask } from "./startup-tasks.js";

function createLogger() {
  return {
    debug: vi.fn(),
    warn: vi.fn(),
  };
}

describe("runStartupTasks", () => {
  it("runs tasks in order and logs skipped/failed outcomes with task identity", async () => {
    const log = createLogger();
    const events: string[] = [];
    const tasks: StartupTask[] = [
      {
        source: "boot-md",
        agentId: "main",
        workspaceDir: "/ws/main",
        run: async () => {
          events.push("boot");
          return { status: "skipped", reason: "missing" };
        },
      },
      {
        source: "restart-sentinel",
        sessionKey: "agent:main:telegram:chat",
        run: async () => {
          events.push("restart");
          return { status: "ran" };
        },
      },
      {
        source: "boot-md",
        agentId: "ops",
        workspaceDir: "/ws/ops",
        run: async () => {
          events.push("ops");
          throw new Error("boom");
        },
      },
    ];

    const results = await runStartupTasks({ tasks, log });

    expect(events).toEqual(["boot", "restart", "ops"]);
    expect(results).toEqual([
      { status: "skipped", reason: "missing" },
      { status: "ran" },
      { status: "failed", reason: "boom" },
    ]);
    expect(log.debug).toHaveBeenCalledWith("startup task skipped", {
      source: "boot-md",
      agentId: "main",
      workspaceDir: "/ws/main",
      reason: "missing",
    });
    expect(log.warn).toHaveBeenCalledWith("startup task failed", {
      source: "boot-md",
      agentId: "ops",
      workspaceDir: "/ws/ops",
      reason: "boom",
    });
  });
});

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