Spaces:
Paused
Paused
File size: 1,063 Bytes
fb4d8fe | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | import { describe, expect, it } from "vitest";
import { stripRedundantSubsystemPrefixForConsole } from "../logging.js";
describe("stripRedundantSubsystemPrefixForConsole", () => {
it("drops '<subsystem>:' prefix", () => {
expect(stripRedundantSubsystemPrefixForConsole("discord: hello", "discord")).toBe("hello");
});
it("drops '<Subsystem>:' prefix case-insensitively", () => {
expect(stripRedundantSubsystemPrefixForConsole("WhatsApp: hello", "whatsapp")).toBe("hello");
});
it("drops '<subsystem> ' prefix", () => {
expect(stripRedundantSubsystemPrefixForConsole("discord gateway: closed", "discord")).toBe(
"gateway: closed",
);
});
it("drops '[subsystem]' prefix", () => {
expect(stripRedundantSubsystemPrefixForConsole("[discord] connection stalled", "discord")).toBe(
"connection stalled",
);
});
it("keeps messages that do not start with the subsystem", () => {
expect(stripRedundantSubsystemPrefixForConsole("discordant: hello", "discord")).toBe(
"discordant: hello",
);
});
});
|