UNPKG

610 Btext/coffeescriptView Raw
1{describe,it,expect,beforeEach} = global
2HTMLToPDF = require '../'
3fs = require 'fs-extra'
4path = require 'path'
5
6describe '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