Skip to content

Commit 2bb2210

Browse files
updated .load, .loadRoot, rootTemplate and preTemplates to allow for supplying buffers in addition to file paths.
1 parent a606c56 commit 2bb2210

File tree

8 files changed

+6616
-573
lines changed

8 files changed

+6616
-573
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import fs from 'fs/promises';
2+
import Automizer from '../src/automizer';
3+
4+
test('create presentation from buffer and add basic slide', async () => {
5+
const automizer = new Automizer({
6+
outputDir: `${__dirname}/pptx-output`,
7+
});
8+
const rootTemplate = await fs.readFile(
9+
`${__dirname}/pptx-templates/RootTemplate.pptx`,
10+
);
11+
const slideWithShapes = await fs.readFile(
12+
`${__dirname}/pptx-templates/SlideWithShapes.pptx`,
13+
);
14+
const pres = automizer.loadRoot(rootTemplate).load(slideWithShapes, 'shapes');
15+
16+
for (let i = 0; i <= 10; i++) {
17+
pres.addSlide('shapes', 1);
18+
}
19+
20+
await pres.write(`create-presentation-from-buffer.test.pptx`);
21+
22+
expect(pres).toBeInstanceOf(Automizer);
23+
});

0 commit comments

Comments
 (0)