@@ -41,7 +41,7 @@ test('pdf.create(html[, options]).toFile([filename, ]callback)', function (t) {
41
41
42
42
pdf . create ( html ) . toFile ( function ( err , pdf ) {
43
43
t . error ( err )
44
- t . assert ( typeof pdf . filename == 'string' , `toFile(callback) returns {filename: '${ pdf . filename } '} as second cb argument` )
44
+ t . assert ( typeof pdf . filename === 'string' , `toFile(callback) returns {filename: '${ pdf . filename } '} as second cb argument` )
45
45
fs . unlink ( pdf . filename )
46
46
} )
47
47
@@ -58,8 +58,8 @@ test('pdf.create(html).toBuffer(callback)', function (t) {
58
58
59
59
pdf . create ( html ) . toBuffer ( function ( err , pdf ) {
60
60
t . error ( err )
61
- t . assert ( Buffer . isBuffer ( pdf ) , " toBuffer(callback) returns a buffer instance as second cb argument" )
62
- t . assert ( / ^ \% P D F - 1 .4 / . test ( pdf . slice ( 0 , 100 ) . toString ( ) ) , " the PDF buffer has a PDF Header" )
61
+ t . assert ( Buffer . isBuffer ( pdf ) , ' toBuffer(callback) returns a buffer instance as second cb argument' )
62
+ t . assert ( / ^ \% P D F - 1 .4 / . test ( pdf . slice ( 0 , 100 ) . toString ( ) ) , ' the PDF buffer has a PDF Header' )
63
63
} )
64
64
} )
65
65
@@ -68,17 +68,17 @@ test('pdf.create(html, {directory: "/tmp"}).toBuffer(callback)', function (t) {
68
68
69
69
pdf . create ( html , { directory : '/tmp' } ) . toBuffer ( function ( err , pdf ) {
70
70
t . error ( err )
71
- t . assert ( Buffer . isBuffer ( pdf ) , " uses the passed directory as tmp dir" )
71
+ t . assert ( Buffer . isBuffer ( pdf ) , ' uses the passed directory as tmp dir' )
72
72
} )
73
73
} )
74
74
75
75
test ( 'pdf.create(html[, options]).toStream(callback)' , function ( t ) {
76
76
t . plan ( 3 )
77
77
78
- stream = pdf . create ( html ) . toStream ( function ( err , stream ) {
78
+ pdf . create ( html ) . toStream ( function ( err , stream ) {
79
79
t . error ( err )
80
- t . assert ( stream instanceof fs . ReadStream , " toStream(callback) returns a fs.ReadStream as second cb argument" )
81
- destination = path . join ( __dirname , 'streamed.pdf' )
80
+ t . assert ( stream instanceof fs . ReadStream , ' toStream(callback) returns a fs.ReadStream as second cb argument' )
81
+ var destination = path . join ( __dirname , 'streamed.pdf' )
82
82
stream . pipe ( fs . createWriteStream ( destination ) )
83
83
stream . on ( 'end' , function ( ) {
84
84
t . assert ( fs . existsSync ( destination ) , 'toStream returns a working readable stream' )
@@ -95,7 +95,7 @@ test('allows custom html and css', function (t) {
95
95
96
96
var template = path . join ( __dirname , '../example/businesscard.html' )
97
97
var filename = template . replace ( '.html' , '.pdf' )
98
- var templateHtml = fs . readFileSync ( template , 'utf8' )
98
+ var templateHtml = fs . readFileSync ( template , 'utf8' )
99
99
100
100
var image = path . join ( 'file://' , __dirname , '../example/image.png' )
101
101
templateHtml = templateHtml . replace ( '{{image}}' , image )
@@ -148,7 +148,7 @@ test('allows custom page and footer options', function (t) {
148
148
. create ( html , options )
149
149
. toFile ( filename , function ( error , pdf ) {
150
150
t . error ( error )
151
- t . assert ( pdf . filename == filename , 'Returns the filename from the phantom script' )
151
+ t . assert ( pdf . filename === filename , 'Returns the filename from the phantom script' )
152
152
t . assert ( fs . existsSync ( pdf . filename ) , 'Saves the pdf with a custom page size and footer' )
153
153
} )
154
154
} )
@@ -162,7 +162,7 @@ test('allows different header and footer for first page', function (t) {
162
162
. create ( enrichedHtml , { quality : 100 } )
163
163
. toFile ( filename , function ( error , pdf ) {
164
164
t . error ( error )
165
- t . assert ( pdf . filename == filename , 'Returns the filename from the phantom script' )
165
+ t . assert ( pdf . filename === filename , 'Returns the filename from the phantom script' )
166
166
t . assert ( fs . existsSync ( pdf . filename ) , 'Saves the pdf with a custom page size and footer' )
167
167
} )
168
168
} )
@@ -176,7 +176,7 @@ test('load external css', function (t) {
176
176
. create ( enrichedHtml )
177
177
. toFile ( filename , function ( error , pdf ) {
178
178
t . error ( error )
179
- t . assert ( pdf . filename == filename , 'Returns the filename from the phantom script' )
179
+ t . assert ( pdf . filename === filename , 'Returns the filename from the phantom script' )
180
180
t . assert ( fs . existsSync ( pdf . filename ) , 'Saves the pdf with a custom page size and footer' )
181
181
} )
182
182
} )
@@ -190,7 +190,7 @@ test('load external js', function (t) {
190
190
. create ( enrichedHtml , { phantomArgs : [ '--ignore-ssl-errors=true' ] } )
191
191
. toFile ( filename , function ( error , pdf ) {
192
192
t . error ( error )
193
- t . assert ( pdf . filename == filename , 'Returns the filename from the phantom script' )
193
+ t . assert ( pdf . filename === filename , 'Returns the filename from the phantom script' )
194
194
t . assert ( fs . existsSync ( pdf . filename ) , 'Saves the pdf with a custom page size and footer' )
195
195
} )
196
196
} )
0 commit comments