feat: 将主题令牌接入 DOCX 动态模板
This commit is contained in:
@@ -42,11 +42,12 @@ function generatedDocx(): DocxExportResult {
|
||||
queueMs: 1,
|
||||
probeMs: 2,
|
||||
prepareMs: 3,
|
||||
mediaMs: 4,
|
||||
referenceMs: 5,
|
||||
pandocMs: 6,
|
||||
validationMs: 7,
|
||||
totalMs: 28
|
||||
themeStyleMs: 4,
|
||||
mediaMs: 5,
|
||||
referenceMs: 6,
|
||||
pandocMs: 7,
|
||||
validationMs: 8,
|
||||
totalMs: 36
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -72,6 +73,8 @@ function createDocxService(
|
||||
|
||||
function createMediaAdapter() {
|
||||
return {
|
||||
themeStyleBaseUrl:
|
||||
"http://localhost:5173/preview-frame.html",
|
||||
capture: vi.fn<
|
||||
DocxMediaCaptureAdapter["capture"]
|
||||
>(async () => ({
|
||||
@@ -82,6 +85,9 @@ function createMediaAdapter() {
|
||||
},
|
||||
captures: []
|
||||
})),
|
||||
captureThemeStyle: vi.fn(async () => {
|
||||
throw new Error("此测试使用注入的 DOCX 导出服务");
|
||||
}),
|
||||
close: vi.fn(async () => undefined)
|
||||
} satisfies ServerDocxMediaCaptureAdapter;
|
||||
}
|
||||
@@ -173,7 +179,7 @@ describe("DOCX HTTP API", () => {
|
||||
"runtime-probe;dur=2.0"
|
||||
);
|
||||
expect(response.headers["server-timing"]).toContain(
|
||||
"pandoc;dur=6.0"
|
||||
"pandoc;dur=7.0"
|
||||
);
|
||||
expect(response.rawPayload).toEqual(
|
||||
Buffer.from([80, 75, 3, 4])
|
||||
|
||||
Reference in New Issue
Block a user