chore(logging): strip redundant console prefixes
This commit is contained in:
1 parent
58d1d11762
commit
62bdbe1821
2 files changed
+51
-1
No files matched your search
@@ -0,0 +1,26 @@
|
||||
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", () => {
|
||||
expect(
|
||||
stripRedundantSubsystemPrefixForConsole(
|
||||
"discord gateway: closed",
|
||||
"discord",
|
||||
),
|
||||
).toBe("gateway: closed");
|
||||
});
|
||||
|
||||
it("keeps messages that do not start with the subsystem", () => {
|
||||
expect(
|
||||
stripRedundantSubsystemPrefixForConsole("discordant: hello", "discord"),
|
||||
).toBe("discordant: hello");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user