mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-19 16:25:50 +00:00
test: tighten feishu comment reaction requests
This commit is contained in:
parent
cfaf8c8d5d
commit
90e355a3b6
1 changed files with 20 additions and 54 deletions
|
|
@ -18,6 +18,21 @@ vi.mock("./client.js", () => ({
|
|||
|
||||
describe("createCommentTypingReactionLifecycle", () => {
|
||||
const request = vi.fn();
|
||||
const commentReactionUrl =
|
||||
"/open-apis/drive/v2/files/doc_token_1/comments/reaction?file_type=docx";
|
||||
|
||||
function expectedTypingReactionRequest(action: "add" | "delete") {
|
||||
return {
|
||||
method: "POST",
|
||||
url: commentReactionUrl,
|
||||
data: {
|
||||
action,
|
||||
reply_id: "reply_1",
|
||||
reaction_type: "Typing",
|
||||
},
|
||||
timeout: 30_000,
|
||||
};
|
||||
}
|
||||
|
||||
afterAll(() => {
|
||||
vi.doUnmock("./accounts.js");
|
||||
|
|
@ -71,30 +86,8 @@ describe("createCommentTypingReactionLifecycle", () => {
|
|||
await lifecycle.start();
|
||||
await lifecycle.cleanup();
|
||||
|
||||
expect(request).toHaveBeenNthCalledWith(
|
||||
1,
|
||||
expect.objectContaining({
|
||||
method: "POST",
|
||||
url: "/open-apis/drive/v2/files/doc_token_1/comments/reaction?file_type=docx",
|
||||
data: {
|
||||
action: "add",
|
||||
reply_id: "reply_1",
|
||||
reaction_type: "Typing",
|
||||
},
|
||||
}),
|
||||
);
|
||||
expect(request).toHaveBeenNthCalledWith(
|
||||
2,
|
||||
expect.objectContaining({
|
||||
method: "POST",
|
||||
url: "/open-apis/drive/v2/files/doc_token_1/comments/reaction?file_type=docx",
|
||||
data: {
|
||||
action: "delete",
|
||||
reply_id: "reply_1",
|
||||
reaction_type: "Typing",
|
||||
},
|
||||
}),
|
||||
);
|
||||
expect(request).toHaveBeenNthCalledWith(1, expectedTypingReactionRequest("add"));
|
||||
expect(request).toHaveBeenNthCalledWith(2, expectedTypingReactionRequest("delete"));
|
||||
});
|
||||
|
||||
it("skips requests when reply_id is missing", async () => {
|
||||
|
|
@ -114,16 +107,7 @@ describe("createCommentTypingReactionLifecycle", () => {
|
|||
await lifecycle.cleanup();
|
||||
|
||||
expect(request).toHaveBeenCalledTimes(2);
|
||||
expect(request).toHaveBeenNthCalledWith(
|
||||
2,
|
||||
expect.objectContaining({
|
||||
data: {
|
||||
action: "delete",
|
||||
reply_id: "reply_1",
|
||||
reaction_type: "Typing",
|
||||
},
|
||||
}),
|
||||
);
|
||||
expect(request).toHaveBeenNthCalledWith(2, expectedTypingReactionRequest("delete"));
|
||||
});
|
||||
|
||||
it("retries delete during later cleanup after an ambient delete failure", async () => {
|
||||
|
|
@ -148,25 +132,7 @@ describe("createCommentTypingReactionLifecycle", () => {
|
|||
await lifecycle.cleanup();
|
||||
|
||||
expect(request).toHaveBeenCalledTimes(3);
|
||||
expect(request).toHaveBeenNthCalledWith(
|
||||
2,
|
||||
expect.objectContaining({
|
||||
data: {
|
||||
action: "delete",
|
||||
reply_id: "reply_1",
|
||||
reaction_type: "Typing",
|
||||
},
|
||||
}),
|
||||
);
|
||||
expect(request).toHaveBeenNthCalledWith(
|
||||
3,
|
||||
expect.objectContaining({
|
||||
data: {
|
||||
action: "delete",
|
||||
reply_id: "reply_1",
|
||||
reaction_type: "Typing",
|
||||
},
|
||||
}),
|
||||
);
|
||||
expect(request).toHaveBeenNthCalledWith(2, expectedTypingReactionRequest("delete"));
|
||||
expect(request).toHaveBeenNthCalledWith(3, expectedTypingReactionRequest("delete"));
|
||||
});
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue