Skip to content

Commit ef9dbbc

Browse files
committed
Tests fix
1 parent 3fad97a commit ef9dbbc

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

test/test-pdf-creation.js

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,15 @@ console.log('Line 3');
9090
// 3. Insert an appendix page at the end (from markdown)
9191
// 4. Merge the temporary PDF at the very end (from file path)
9292

93-
await writePdf(MODIFIED_FILE, [
93+
// writePdf signature: writePdf(sourcePath, operations, outputPath)
94+
await writePdf(OUTPUT_FILE, [
9495
{
9596
type: 'delete',
96-
pageIndex: 0
97+
pageIndexes: [0]
9798
},
9899
{
99100
type: 'delete',
100-
pageIndex: -1 // Delete the last page.
101+
pageIndexes: [-1] // Delete the last page.
101102
// Sequential execution:
102103
// 1. Original: [Page 1, Page 2]
103104
// 2. Delete 0 (Page 1): [Page 2]
@@ -106,22 +107,22 @@ console.log('Line 3');
106107
{
107108
type: 'insert',
108109
pageIndex: 0,
109-
markdownContent: '# New Cover Page\n\nThis page was inserted dynamically.\n\n## Summary\nWe deleted the original pages and added this one.'
110+
markdown: '# New Cover Page\n\nThis page was inserted dynamically.\n\n## Summary\nWe deleted the original pages and added this one.'
110111
// 4. Insert at 0: [New Cover Page]
111112
},
112113
{
113114
type: 'insert',
114115
pageIndex: 1, // Append to end (count is 1)
115-
markdownContent: '# Appendix\n\nThis page was appended to the end.'
116+
markdown: '# Appendix\n\nThis page was appended to the end.'
116117
// 5. Insert at 1: [New Cover Page, Appendix]
117118
},
118119
{
119120
type: 'insert',
120121
pageIndex: 2, // Append to end (count is 2)
121-
sourcePdf: tempMergeFile
122+
sourcePdfPath: tempMergeFile
122123
// 6. Insert at 2: [New Cover Page, Appendix, Merged Page]
123124
}
124-
], { sourcePdf: OUTPUT_FILE });
125+
], MODIFIED_FILE);
125126

126127
console.log('✅ PDF modified successfully');
127128
console.log(` Saved to: ${MODIFIED_FILE}`);

0 commit comments

Comments
 (0)