import { describe, expect, it } from "vitest"; import { qqbotPlugin } from "./channel.js";
// --------------------------------------------------------------------------- // qqbot: prefix normalization for inbound commandAuthorized // // Uses qqbotPlugin.config.formatAllowFrom directly — the same function the // fixed gateway.ts inbound path calls — so the test stays in sync with the // actual implementation without duplicating the logic. // ---------------------------------------------------------------------------
it("authorizes when allowFrom uses qqbot: prefix and senderId is the bare id", () => {
expect(resolveInboundCommandAuthorized(["qqbot:USER123"], "USER123")).toBe(true);
});
it("authorizes when qqbot: prefix is mixed case", () => {
expect(resolveInboundCommandAuthorized(["QQBot:user123"], "USER123")).toBe(true);
});
it("denies a sender not in the qqbot:-prefixed allowFrom list", () => {
expect(resolveInboundCommandAuthorized(["qqbot:USER123"], "OTHER")).toBe(false);
});
it("authorizes any sender when allowFrom is empty (open)", () => {
expect(resolveInboundCommandAuthorized([], "ANYONE")).toBe(true);
});
it("authorizes any sender when allowFrom contains wildcard *", () => {
expect(resolveInboundCommandAuthorized(["*"], "ANYONE")).toBe(true);
});
});
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.10 Sekunden
(vorverarbeitet am 2026-06-10)
¤
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.