import { describe, expect, it } from "vitest"; import {
looksLikeDiscordTargetId,
normalizeDiscordMessagingTarget,
normalizeDiscordOutboundTarget,
} from "./normalize.js";
describe("discord target normalization", () => {
it("normalizes bare messaging target ids to channel targets", () => {
expect(normalizeDiscordMessagingTarget("1234567890")).toBe("channel:1234567890");
});
it("keeps explicit outbound targets and rejects missing recipients", () => {
expect(normalizeDiscordOutboundTarget("1234567890")).toEqual({
ok: true,
to: "channel:1234567890",
});
expect(normalizeDiscordOutboundTarget("user:42")).toEqual({
ok: true,
to: "user:42",
});
const result = normalizeDiscordOutboundTarget(" ");
expect(result.ok).toBe(false); if (!result.ok) {
expect(result.error.message).toContain("Discord recipient is required");
}
});
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.