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

Quelle  group-policy.test.ts

  Sprache: JAVA
 

import { describe, expect, it } from "vitest";
import {
  buildZalouserGroupCandidates,
  findZalouserGroupEntry,
  isZalouserGroupEntryAllowed,
  normalizeZalouserGroupSlug,
} from "./group-policy.js";

describe("zalouser group policy helpers", () => {
  it("normalizes group slug names", () => {
    expect(normalizeZalouserGroupSlug(" Team Alpha ")).toBe("team-alpha");
    expect(normalizeZalouserGroupSlug("#Roadmap Updates")).toBe("roadmap-updates");
  });

  it("builds ordered candidates with optional aliases", () => {
    expect(
      buildZalouserGroupCandidates({
        groupId: "123",
        groupChannel: "chan-1",
        groupName: "Team Alpha",
        includeGroupIdAlias: true,
      }),
    ).toEqual(["123""group:123""chan-1""Team Alpha""team-alpha""*"]);
  });

  it("builds id-only candidates when name matching is disabled", () => {
    expect(
      buildZalouserGroupCandidates({
        groupId: "123",
        groupChannel: "chan-1",
        groupName: "Team Alpha",
        includeGroupIdAlias: true,
        allowNameMatching: false,
      }),
    ).toEqual(["123""group:123""*"]);
  });

  it("finds the first matching group entry", () => {
    const groups = {
      "group:123": { enabled: true },
      "team-alpha": { requireMention: false },
      "*": { requireMention: true },
    };
    const entry = findZalouserGroupEntry(
      groups,
      buildZalouserGroupCandidates({
        groupId: "123",
        groupName: "Team Alpha",
        includeGroupIdAlias: true,
      }),
    );
    expect(entry).toEqual({ enabled: true });
  });

  it("evaluates allow/enable flags", () => {
    expect(isZalouserGroupEntryAllowed({ enabled: true })).toBe(true);
    expect(isZalouserGroupEntryAllowed({ allow: false } as never)).toBe(false);
    expect(isZalouserGroupEntryAllowed({ enabled: false })).toBe(false);
    expect(isZalouserGroupEntryAllowed(undefined)).toBe(false);
  });
});

Messung V0.5 in Prozent
C=99 H=96 G=97

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