1 | {describe,it,expect,beforeEach} = global
|
2 | HTMLToPDF = require '../'
|
3 | fs = require 'fs-extra'
|
4 | path = require 'path'
|
5 |
|
6 | describe 'Generate PDF', ->
|
7 | beforeEach ->
|
8 | @outputPath = path.join __dirname, '..', 'tmp', 'test.pdf'
|
9 | fs.mkdirpSync path.dirname @outputPath
|
10 | try
|
11 | fs.unlinkSync @outputPath
|
12 |
|
13 | beforeEach (done) ->
|
14 | @timeout 50000
|
15 |
|
16 | @sut = new HTMLToPDF {
|
17 | renderDelay: 5,
|
18 | @outputPath,
|
19 | inputBody: '<h1>Hello my friend</h1>'
|
20 | }
|
21 |
|
22 | @sut.build (error) => done error
|
23 |
|
24 | it 'should have created a test.pdf', ->
|
25 | expect(fs.existsSync(@outputPath)).to.be.true
|