test: align whatsapp expectations with current contracts
This commit is contained in:
parent
b8b1e2cf50
commit
16567ba4e7
@ -35,6 +35,10 @@ describe("whatsappPlugin outbound sendPoll", () => {
|
||||
});
|
||||
|
||||
expectWhatsAppPollSent(hoisted.sendPollWhatsApp, { cfg, poll, to, accountId });
|
||||
expect(result).toEqual({ messageId: "wa-poll-1", toJid: "1555@s.whatsapp.net" });
|
||||
expect(result).toEqual({
|
||||
channel: "whatsapp",
|
||||
messageId: "wa-poll-1",
|
||||
toJid: "1555@s.whatsapp.net",
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@ -84,7 +84,7 @@ describe("whatsapp resolveTarget", () => {
|
||||
if (!result.ok) {
|
||||
throw result.error;
|
||||
}
|
||||
expect(result.to).toBe("5511999999999@s.whatsapp.net");
|
||||
expect(result.to).toBe("+5511999999999");
|
||||
});
|
||||
|
||||
it("should resolve target in implicit mode with wildcard", () => {
|
||||
@ -98,7 +98,7 @@ describe("whatsapp resolveTarget", () => {
|
||||
if (!result.ok) {
|
||||
throw result.error;
|
||||
}
|
||||
expect(result.to).toBe("5511999999999@s.whatsapp.net");
|
||||
expect(result.to).toBe("+5511999999999");
|
||||
});
|
||||
|
||||
it("should resolve target in implicit mode when in allowlist", () => {
|
||||
@ -112,7 +112,7 @@ describe("whatsapp resolveTarget", () => {
|
||||
if (!result.ok) {
|
||||
throw result.error;
|
||||
}
|
||||
expect(result.to).toBe("5511999999999@s.whatsapp.net");
|
||||
expect(result.to).toBe("+5511999999999");
|
||||
});
|
||||
|
||||
it("should allow group JID regardless of allowlist", () => {
|
||||
|
||||
@ -22,7 +22,7 @@ async function emitCredsUpdateAndReadSaveCreds() {
|
||||
}
|
||||
|
||||
function mockCredsJsonSpies(readContents: string) {
|
||||
const credsSuffix = path.join(".openclaw", "credentials", "whatsapp", "default", "creds.json");
|
||||
const credsSuffix = path.join("/tmp", "openclaw-oauth", "whatsapp", "default", "creds.json");
|
||||
const copySpy = vi.spyOn(fsSync, "copyFileSync").mockImplementation(() => {});
|
||||
const existsSpy = vi.spyOn(fsSync, "existsSync").mockImplementation((p) => {
|
||||
if (typeof p !== "string") {
|
||||
@ -263,8 +263,8 @@ describe("web session", () => {
|
||||
it("rotates creds backup when creds.json is valid JSON", async () => {
|
||||
const creds = mockCredsJsonSpies("{}");
|
||||
const backupSuffix = path.join(
|
||||
".openclaw",
|
||||
"credentials",
|
||||
"/tmp",
|
||||
"openclaw-oauth",
|
||||
"whatsapp",
|
||||
"default",
|
||||
"creds.json.bak",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user