feat: 完善视频任务与 KOC 资源库
This commit is contained in:
@@ -120,6 +120,55 @@ test("resolves a wiki sheet and imports title, body, tags, and all images", asyn
|
||||
assert.equal(valuesCall.url.searchParams.get("ranges"), "sheet-one!A1:J20");
|
||||
});
|
||||
|
||||
test("imports video attachments from a Feishu video task sheet", async () => {
|
||||
clearFeishuAccessTokenCacheForTests();
|
||||
const { fetchImpl } = fakeFeishu();
|
||||
const videoFetch = async (input, init = {}) => {
|
||||
const url = new URL(String(input));
|
||||
if (url.pathname.endsWith("/values_batch_get")) {
|
||||
return apiResponse({
|
||||
valueRanges: [
|
||||
{
|
||||
values: [
|
||||
["标题", "内容(标题+正文+tag)", "视频"],
|
||||
[
|
||||
"一条测试视频",
|
||||
"一条测试视频\n视频正文 #测试",
|
||||
{
|
||||
type: "attachment",
|
||||
fileToken: "video-token-one",
|
||||
text: "demo.mp4",
|
||||
mimeType: "video/mp4",
|
||||
size: 1024,
|
||||
},
|
||||
],
|
||||
],
|
||||
},
|
||||
],
|
||||
});
|
||||
}
|
||||
return fetchImpl(input, init);
|
||||
};
|
||||
const source = await readFeishuSource(
|
||||
"https://tenant.feishu.cn/wiki/wiki-test",
|
||||
bindings,
|
||||
videoFetch,
|
||||
);
|
||||
|
||||
assert.equal(source.rows.length, 1);
|
||||
assert.equal(source.rows[0].title, "一条测试视频");
|
||||
assert.equal(source.rows[0].body, "一条测试视频\n视频正文 #测试");
|
||||
assert.deepEqual(source.rows[0].videos, [
|
||||
{
|
||||
index: 1,
|
||||
fileToken: "video-token-one",
|
||||
name: "demo.mp4",
|
||||
mimeType: "video/mp4",
|
||||
size: 1024,
|
||||
},
|
||||
]);
|
||||
});
|
||||
|
||||
test("requires an exact sheet link when a workbook has multiple visible sheets", async () => {
|
||||
clearFeishuAccessTokenCacheForTests();
|
||||
const { fetchImpl } = fakeFeishu({
|
||||
|
||||
Reference in New Issue
Block a user