From 1494d3c3a6283a00701ac452b8a9a5f8f2f4e9dd Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Wed, 10 Sep 2025 15:55:27 +0100 Subject: Support disabling external file access --- test/mammoth.tests.js | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'test/mammoth.tests.js') diff --git a/test/mammoth.tests.js b/test/mammoth.tests.js index 93a4f16..06cf62f 100644 --- a/test/mammoth.tests.js +++ b/test/mammoth.tests.js @@ -327,6 +327,15 @@ test('error if images stored outside of document are specified when passing file }); }); +test('error if images stored outside of document are specified when external file access is disabled', function() { + var docxPath = path.join(__dirname, "test-data/external-picture.docx"); + return mammoth.convertToHtml({path: docxPath}, {externalFileAccess: false}).then(function(result) { + assert.equal(result.value, ''); + assert.equal(result.messages[0].message, "could not read external image 'tiny-picture.png', external file access is disabled"); + assert.equal(result.messages[0].type, "error"); + }); +}); + test('simple list is converted to list elements', function() { var docxPath = path.join(__dirname, "test-data/simple-list.docx"); return mammoth.convertToHtml({path: docxPath}).then(function(result) { -- cgit v1.2.3