mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-27 09:21:35 +07:00
test: align pairing reply assertions
This commit is contained in:
@@ -236,7 +236,11 @@ describe("discord tool result dispatch", () => {
|
||||
expect(dispatchMock).not.toHaveBeenCalled();
|
||||
expect(upsertPairingRequestMock).toHaveBeenCalled();
|
||||
expect(sendMock).toHaveBeenCalledTimes(1);
|
||||
expect(String(sendMock.mock.calls[0]?.[1] ?? "")).toContain("Your Discord user id: u2");
|
||||
expect(String(sendMock.mock.calls[0]?.[1] ?? "")).toContain("Pairing code: PAIRCODE");
|
||||
const pairingReply = String(sendMock.mock.calls[0]?.[1] ?? "");
|
||||
expect(pairingReply).toContain("OpenClaw: access not configured.");
|
||||
expect(pairingReply).toContain("Your Discord user id: u2");
|
||||
expect(pairingReply).toContain("Pairing code:");
|
||||
expect(pairingReply).toContain("```\nPAIRCODE\n```");
|
||||
expect(pairingReply).toContain("pairing approve discord PAIRCODE");
|
||||
}, 10000);
|
||||
});
|
||||
|
||||
@@ -166,8 +166,12 @@ describe("monitorSignalProvider tool results", () => {
|
||||
expect(replyMock).not.toHaveBeenCalled();
|
||||
expect(upsertPairingRequestMock).toHaveBeenCalled();
|
||||
expect(sendMock).toHaveBeenCalledTimes(1);
|
||||
expect(String(sendMock.mock.calls[0]?.[1] ?? "")).toContain("Your Signal number: +15550001111");
|
||||
expect(String(sendMock.mock.calls[0]?.[1] ?? "")).toContain("Pairing code: PAIRCODE");
|
||||
const pairingReply = String(sendMock.mock.calls[0]?.[1] ?? "");
|
||||
expect(pairingReply).toContain("OpenClaw: access not configured.");
|
||||
expect(pairingReply).toContain("Your Signal number: +15550001111");
|
||||
expect(pairingReply).toContain("Pairing code:");
|
||||
expect(pairingReply).toContain("```\nPAIRCODE\n```");
|
||||
expect(pairingReply).toContain("pairing approve signal PAIRCODE");
|
||||
});
|
||||
|
||||
it("ignores reaction-only messages", async () => {
|
||||
|
||||
@@ -564,8 +564,12 @@ describe("monitorSlackProvider tool results", () => {
|
||||
expect(replyMock).not.toHaveBeenCalled();
|
||||
expect(upsertPairingRequestMock).toHaveBeenCalled();
|
||||
expect(sendMock).toHaveBeenCalledTimes(1);
|
||||
expect(sendMock.mock.calls[0]?.[1]).toContain("Your Slack user id: U1");
|
||||
expect(sendMock.mock.calls[0]?.[1]).toContain("Pairing code: PAIRCODE");
|
||||
const pairingReply = String(sendMock.mock.calls[0]?.[1] ?? "");
|
||||
expect(pairingReply).toContain("OpenClaw: access not configured.");
|
||||
expect(pairingReply).toContain("Your Slack user id: U1");
|
||||
expect(pairingReply).toContain("Pairing code:");
|
||||
expect(pairingReply).toContain("```\nPAIRCODE\n```");
|
||||
expect(pairingReply).toContain("pairing approve slack PAIRCODE");
|
||||
});
|
||||
|
||||
it("does not resend pairing code when a request is already pending", async () => {
|
||||
|
||||
@@ -177,12 +177,14 @@ export function buildNotifyMessageUpsert(params: {
|
||||
|
||||
export function expectPairingPromptSent(sock: MockSock, jid: string, senderE164: string) {
|
||||
expect(sock.sendMessage).toHaveBeenCalledTimes(1);
|
||||
expect(sock.sendMessage).toHaveBeenCalledWith(jid, {
|
||||
text: expect.stringContaining(`Your WhatsApp phone number: ${senderE164}`),
|
||||
});
|
||||
expect(sock.sendMessage).toHaveBeenCalledWith(jid, {
|
||||
text: expect.stringContaining("Pairing code: PAIRCODE"),
|
||||
});
|
||||
const sendCall = sock.sendMessage.mock.calls[0];
|
||||
expect(sendCall?.[0]).toBe(jid);
|
||||
const text = String((sendCall?.[1] as { text?: string } | undefined)?.text ?? "");
|
||||
expect(text).toContain("OpenClaw: access not configured.");
|
||||
expect(text).toContain(`Your WhatsApp phone number: ${senderE164}`);
|
||||
expect(text).toContain("Pairing code:");
|
||||
expect(text).toContain("```\nPAIRCODE\n```");
|
||||
expect(text).toContain("pairing approve whatsapp PAIRCODE");
|
||||
}
|
||||
|
||||
let authDir: string | undefined;
|
||||
|
||||
Reference in New Issue
Block a user