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


Quelle  private-qa-cli.test.ts

  Sprache: JAVA
 

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

import fs from "node:fs";
import os from "node:os";
import path from "node:path";
import { afterEach, describe, expect, it, vi } from "vitest";
import { loadPrivateQaCliModule } from "./private-qa-cli.js";

describe("private-qa-cli", () => {
  const tempDirs: string[] = [];
  const originalPrivateQaCli = process.env.OPENCLAW_ENABLE_PRIVATE_QA_CLI;

  afterEach(() => {
    for (const dir of tempDirs.splice(0)) {
      fs.rmSync(dir, { recursive: true, force: true });
    }
    if (originalPrivateQaCli === undefined) {
      delete process.env.OPENCLAW_ENABLE_PRIVATE_QA_CLI;
    } else {
      process.env.OPENCLAW_ENABLE_PRIVATE_QA_CLI = originalPrivateQaCli;
    }
  });

  it("loads the private QA CLI from a source checkout path", async () => {
    process.env.OPENCLAW_ENABLE_PRIVATE_QA_CLI = "1";
    const repoRoot = fs.mkdtempSync(path.join(os.tmpdir(), "openclaw-private-qa-source-"));
    tempDirs.push(repoRoot);
    const expectedPaths = new Set([
      path.join(repoRoot, ".git"),
      path.join(repoRoot, "src"),
      path.join(repoRoot, "dist", "plugin-sdk", "qa-lab.js"),
    ]);
    let importedSpecifier: string | undefined;
    const importModule = vi.fn(async (specifier: string) => {
      importedSpecifier = specifier;
      return {
        isQaLabCliAvailable: expect.any(Function),
        registerQaLabCli: expect.any(Function),
      };
    });

    const module = await loadPrivateQaCliModule({
      importModule,
      resolvePackageRootSync: () => repoRoot,
      existsSync: (filePath) => typeof filePath === "string" && expectedPaths.has(filePath),
    });

    expect(importModule).toHaveBeenCalledTimes(1);
    expect(importedSpecifier).toContain("/dist/plugin-sdk/qa-lab.js");
    expect(module).toMatchObject({
      isQaLabCliAvailable: expect.any(Function),
      registerQaLabCli: expect.any(Function),
    });
  });

  it("rejects non-source package roots even when private QA is enabled", async () => {
    process.env.OPENCLAW_ENABLE_PRIVATE_QA_CLI = "1";
    const root = fs.mkdtempSync(path.join(os.tmpdir(), "openclaw-private-qa-"));
    tempDirs.push(root);
    fs.writeFileSync(path.join(root, "package.json"), JSON.stringify({ name: "openclaw" }), "utf8");
    const importModule = vi.fn(async () => ({}));

    expect(() =>
      loadPrivateQaCliModule({
        resolvePackageRootSync: () => root,
        importModule,
      }),
    ).toThrow("Private QA CLI is only available from an OpenClaw source checkout.");
    expect(importModule).not.toHaveBeenCalled();
  });

  it("rejects when the private QA env flag is disabled", async () => {
    delete process.env.OPENCLAW_ENABLE_PRIVATE_QA_CLI;
    const importModule = vi.fn(async () => ({}));

    expect(() => loadPrivateQaCliModule({ importModule })).toThrow(
      "Private QA CLI is only available from an OpenClaw source checkout.",
    );
    expect(importModule).not.toHaveBeenCalled();
  });
});

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






                                                                                                                                                                                                                                                                                                                                                                                                     


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