@@ -309,27 +309,27 @@ test('src of inline images can be changed using readAsBuffer()', function() {
309309 } ) ;
310310} ) ;
311311
312- test ( 'images stored outside of document are included in output' , function ( ) {
312+ test ( 'when external file access is enabled then images stored outside of document are included in output' , function ( ) {
313313 var docxPath = path . join ( __dirname , "test-data/external-picture.docx" ) ;
314- return mammoth . convertToHtml ( { path : docxPath } ) . then ( function ( result ) {
314+ return mammoth . convertToHtml ( { path : docxPath } , { externalFileAccess : true } ) . then ( function ( result ) {
315315 assert . equal ( result . value , '<p><img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAIAAAACUFjqAAAAAXNSR0IArs4c6QAAAAlwSFlzAAAOvgAADr4B6kKxwAAAABNJREFUKFNj/M+ADzDhlWUYqdIAQSwBE8U+X40AAAAASUVORK5CYII=" /></p>' ) ;
316316 assert . deepEqual ( result . messages , [ ] ) ;
317317 } ) ;
318318} ) ;
319319
320- test ( 'error if images stored outside of document are specified when passing file without path' , function ( ) {
320+ test ( 'when external file access is enabled then error if images stored outside of document are specified when passing file without path' , function ( ) {
321321 var docxPath = path . join ( __dirname , "test-data/external-picture.docx" ) ;
322322 var buffer = fs . readFileSync ( docxPath ) ;
323- return mammoth . convertToHtml ( { buffer : buffer } ) . then ( function ( result ) {
323+ return mammoth . convertToHtml ( { buffer : buffer } , { externalFileAccess : true } ) . then ( function ( result ) {
324324 assert . equal ( result . value , '' ) ;
325325 assert . equal ( result . messages [ 0 ] . message , "could not find external image 'tiny-picture.png', path of input document is unknown" ) ;
326326 assert . equal ( result . messages [ 0 ] . type , "error" ) ;
327327 } ) ;
328328} ) ;
329329
330- test ( 'error if images stored outside of document are specified when external file access is disabled ' , function ( ) {
330+ test ( 'given external file access is disabled by default then error if images stored outside of document are specified' , function ( ) {
331331 var docxPath = path . join ( __dirname , "test-data/external-picture.docx" ) ;
332- return mammoth . convertToHtml ( { path : docxPath } , { externalFileAccess : false } ) . then ( function ( result ) {
332+ return mammoth . convertToHtml ( { path : docxPath } ) . then ( function ( result ) {
333333 assert . equal ( result . value , '' ) ;
334334 assert . equal ( result . messages [ 0 ] . message , "could not read external image 'tiny-picture.png', external file access is disabled" ) ;
335335 assert . equal ( result . messages [ 0 ] . type , "error" ) ;
0 commit comments