it("falls back to create for withdrawn post replies", async () => {
replyMock.mockResolvedValue({
code: 230011,
msg: "The message was withdrawn.",
});
createMock.mockResolvedValue({
code: 0,
data: { message_id: "om_new" },
});
await expectFallbackResult(
() =>
sendMessageFeishu({
cfg: {} as never,
to: "user:ou_target",
text: "hello",
replyToMessageId: "om_parent",
}), "om_new",
);
});
it("falls back to create for withdrawn card replies", async () => {
replyMock.mockResolvedValue({
code: 231003,
msg: "The message is not found",
});
createMock.mockResolvedValue({
code: 0,
data: { message_id: "om_card_new" },
});
await expect(
sendMessageFeishu({
cfg: {} as never,
to: "user:ou_target",
text: "hello",
replyToMessageId: "om_parent",
}),
).rejects.toThrow("rate limited");
expect(createMock).not.toHaveBeenCalled();
});
it("fails thread replies instead of falling back to a top-level send", async () => {
replyMock.mockResolvedValue({
code: 230011,
msg: "The message was withdrawn.",
});
await expect(
sendMessageFeishu({
cfg: {} as never,
to: "chat:oc_group_1",
text: "hello",
replyToMessageId: "om_parent",
replyInThread: true,
}),
).rejects.toThrow( "Feishu thread reply failed: reply target is unavailable and cannot safely fall back to a top-level send.",
);
it("fails thrown withdrawn thread replies instead of falling back to create", async () => { const sdkError = Object.assign(new Error("request failed"), { code: 230011 });
replyMock.mockRejectedValue(sdkError);
await expect(
sendMessageFeishu({
cfg: {} as never,
to: "chat:oc_group_1",
text: "hello",
replyToMessageId: "om_parent",
replyInThread: true,
}),
).rejects.toThrow( "Feishu thread reply failed: reply target is unavailable and cannot safely fall back to a top-level send.",
);
expect(createMock).not.toHaveBeenCalled();
});
it("still falls back for non-thread replies to withdrawn targets", async () => {
replyMock.mockResolvedValue({
code: 230011,
msg: "The message was withdrawn.",
});
createMock.mockResolvedValue({
code: 0,
data: { message_id: "om_non_thread_fallback" },
});
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.