mirror of
https://github.com/moltbot/moltbot.git
synced 2026-05-17 02:37:33 +00:00
test: dedupe mattermost slash log reads
This commit is contained in:
@@ -142,6 +142,11 @@ async function runSlashRequest(params: {
|
||||
return response;
|
||||
}
|
||||
|
||||
function firstLogMessage(log: ReturnType<typeof vi.fn>): string {
|
||||
const message = log.mock.calls[0]?.[0];
|
||||
return typeof message === "string" ? message : "";
|
||||
}
|
||||
|
||||
describe("slash-http", () => {
|
||||
beforeEach(() => {
|
||||
resetMattermostSlashCommandValidationCacheForTests();
|
||||
@@ -628,7 +633,7 @@ describe("slash-http", () => {
|
||||
).resolves.toBe(false);
|
||||
|
||||
expect(log).toHaveBeenCalledTimes(1);
|
||||
const message = log.mock.calls.at(0)?.[0] ?? "";
|
||||
const message = firstLogMessage(log);
|
||||
expect(message).not.toMatch(/[\r\n\t]/u);
|
||||
expect(message).toContain("deleted command cmd-1 spoofed");
|
||||
expect(message).toContain("using team list fallback");
|
||||
@@ -753,7 +758,7 @@ describe("slash-http", () => {
|
||||
).resolves.toBe(true);
|
||||
|
||||
expect(log).toHaveBeenCalledTimes(1);
|
||||
const message = log.mock.calls.at(0)?.[0] ?? "";
|
||||
const message = firstLogMessage(log);
|
||||
expect(message).not.toMatch(/[\r\n\t]/u);
|
||||
expect(message).toContain("/oc_status spoofed");
|
||||
expect(message).toContain("primary token=[redacted]");
|
||||
@@ -792,7 +797,7 @@ describe("slash-http", () => {
|
||||
).resolves.toBe(false);
|
||||
|
||||
expect(log).toHaveBeenCalledTimes(1);
|
||||
const message = log.mock.calls.at(0)?.[0] ?? "";
|
||||
const message = firstLogMessage(log);
|
||||
expect(message).not.toMatch(/[\r\n\t]/u);
|
||||
expect(message).toContain("fallback second-line");
|
||||
expect(message).toContain("botToken: [redacted]");
|
||||
|
||||
Reference in New Issue
Block a user