Add KOC resource filters and export

This commit is contained in:
巫凤萍
2026-08-06 10:18:23 +08:00
parent 85110bbfce
commit 72f8862f8a
6 changed files with 623 additions and 18 deletions

View File

@@ -50,3 +50,34 @@ test("creates an xlsx archive whose pictures are embedded in worksheet cells", (
assert.match(strFromU8(archive["xl/drawings/drawing1.xml"]), /oneCellAnchor/);
assert.match(strFromU8(archive["xl/drawings/_rels/drawing1.xml.rels"]), /image2\.png/);
});
test("creates clickable external hyperlinks for resource exports", () => {
const workbook = buildRecoveryWorkbook({
sheetName: "KOC资源库",
headers: ["账号名称", "账号主页"],
columnWidths: [20, 40],
rows: [
{
cells: ["小满的轻生活", "https://www.xiaohongshu.com/user/profile/test?x=1&y=2"],
images: [],
hyperlinks: [
{
column: 1,
url: "https://www.xiaohongshu.com/user/profile/test?x=1&y=2",
},
],
},
],
});
const archive = unzipSync(workbook);
const sheet = strFromU8(archive["xl/worksheets/sheet1.xml"]);
const relationships = strFromU8(
archive["xl/worksheets/_rels/sheet1.xml.rels"],
);
assert.match(sheet, /<hyperlink ref="B2" r:id="rId1"\/>/);
assert.match(sheet, /<c r="B2" t="inlineStr" s="5">/);
assert.match(relationships, /relationships\/hyperlink/);
assert.match(relationships, /TargetMode="External"/);
assert.match(relationships, /x=1&amp;y=2/);
});