Commit 003dcae for mammothjs

commit 003dcae99c0871ed44fd344576bc4bad37fb1222
Author: Michael Williamson <mike@zwobble.org>
Date:   Thu Sep 17 22:38:29 2026 +0100

    Add tests for .done() on promises returned by public API

diff --git a/test/mammoth.tests.js b/test/mammoth.tests.js
index 0291c6a..11cd583 100644
--- a/test/mammoth.tests.js
+++ b/test/mammoth.tests.js
@@ -520,3 +520,38 @@ test('should throw error if file is not a valid docx document', function() {
         assert.equal(error.message, "Could not find main document part. Are you sure this is a valid .docx file?");
     });
 });
+
+test("Promise.done() is available", {
+    "on convertToHtml()": function() {
+        var docxPath = path.join(__dirname, "test-data/single-paragraph.docx");
+        return mammoth.convertToHtml({path: docxPath}).done();
+    },
+
+    "on convertToMarkdown()": function() {
+        var docxPath = path.join(__dirname, "test-data/single-paragraph.docx");
+        return mammoth.convertToMarkdown({path: docxPath}).done();
+    },
+
+    "on extractRawText()": function() {
+        var docxPath = path.join(__dirname, "test-data/single-paragraph.docx");
+        return mammoth.extractRawText({path: docxPath}).done();
+    },
+
+    "on embedStyleMap()": function() {
+        var docxPath = path.join(__dirname, "test-data/single-paragraph.docx");
+        return fs.readFile(docxPath).then(function(buffer) {
+            return mammoth.embedStyleMap({buffer: buffer}, "p => h1").done();
+        });
+    },
+
+    "on readEmbeddedStyleMap()": function() {
+        var docxPath = path.join(__dirname, "test-data/single-paragraph.docx");
+        return fs.readFile(docxPath)
+            .then(function(buffer) {
+                return mammoth.embedStyleMap({buffer: buffer}, "p => h1");
+            })
+            .then(function(docx) {
+                return mammoth.readEmbeddedStyleMap({buffer: docx.toBuffer()}).done();
+            });
+    }
+});