mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-22 13:48:10 +00:00
fix(feishu): add documentBlockDescendant mock to docx.test.ts
write/append now use the Descendant API (documentBlockDescendant.create) instead of Children API. The existing test mock was missing this SDK method, causing processImages to never be reached and fetchRemoteMedia to go uncalled. Added blockDescendantCreateMock returning an image block so the 'skips image upload when markdown image URL is blocked' test flows through processImages as expected.
This commit is contained in:
@@ -29,6 +29,7 @@ describe("feishu_doc image fetch hardening", () => {
|
||||
const blockChildrenCreateMock = vi.hoisted(() => vi.fn());
|
||||
const blockChildrenGetMock = vi.hoisted(() => vi.fn());
|
||||
const blockChildrenBatchDeleteMock = vi.hoisted(() => vi.fn());
|
||||
const blockDescendantCreateMock = vi.hoisted(() => vi.fn());
|
||||
const driveUploadAllMock = vi.hoisted(() => vi.fn());
|
||||
const permissionMemberCreateMock = vi.hoisted(() => vi.fn());
|
||||
const blockPatchMock = vi.hoisted(() => vi.fn());
|
||||
@@ -52,6 +53,9 @@ describe("feishu_doc image fetch hardening", () => {
|
||||
get: blockChildrenGetMock,
|
||||
batchDelete: blockChildrenBatchDeleteMock,
|
||||
},
|
||||
documentBlockDescendant: {
|
||||
create: blockDescendantCreateMock,
|
||||
},
|
||||
},
|
||||
drive: {
|
||||
media: {
|
||||
@@ -95,6 +99,11 @@ describe("feishu_doc image fetch hardening", () => {
|
||||
data: { items: [{ block_id: "placeholder_block_1" }] },
|
||||
});
|
||||
blockChildrenBatchDeleteMock.mockResolvedValue({ code: 0 });
|
||||
// write/append use Descendant API; return image block so processImages runs
|
||||
blockDescendantCreateMock.mockResolvedValue({
|
||||
code: 0,
|
||||
data: { children: [{ block_type: 27, block_id: "img_block_1" }] },
|
||||
});
|
||||
driveUploadAllMock.mockResolvedValue({ file_token: "token_1" });
|
||||
documentCreateMock.mockResolvedValue({
|
||||
code: 0,
|
||||
|
||||
Reference in New Issue
Block a user