aboutsummaryrefslogtreecommitdiff
path: root/test/mammoth.tests.js
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2026-09-16 23:08:58 +0100
committerMichael Williamson <mike@zwobble.org>2026-09-16 23:09:31 +0100
commit36d98ebbd6463899737008eaa5147449c9d8e7f2 (patch)
tree80adf97bc0394495432aae6d31f805dd8c2f2b3e /test/mammoth.tests.js
parent0d13c71b3b8d4adb8d59e5e586f6e5f1a284107d (diff)
Prefer fs.promises to promisfying fs functions
Diffstat (limited to 'test/mammoth.tests.js')
-rw-r--r--test/mammoth.tests.js13
1 files changed, 6 insertions, 7 deletions
diff --git a/test/mammoth.tests.js b/test/mammoth.tests.js
index 038cbdf..0291c6a 100644
--- a/test/mammoth.tests.js
+++ b/test/mammoth.tests.js
@@ -1,10 +1,9 @@
var assert = require("assert");
var path = require("path");
-var fs = require("fs");
var _ = require("underscore");
var mammoth = require("../");
-var promises = require("../lib/promises");
+var fs = require("../lib/fs");
var results = require("../lib/results");
var testing = require("./testing");
@@ -23,7 +22,7 @@ test('should convert docx containing one paragraph to single p element', functio
test('should convert docx represented by a Buffer', function() {
var docxPath = path.join(__dirname, "test-data/single-paragraph.docx");
- return promises.nfcall(fs.readFile, docxPath)
+ return fs.readFile(docxPath)
.then(function(buffer) {
return mammoth.convertToHtml({buffer: buffer});
})
@@ -124,7 +123,7 @@ test('embedded style maps can be disabled', function() {
test('embedded style map can be written using toBuffer() and then read', function() {
var docxPath = path.join(__dirname, "test-data/single-paragraph.docx");
- return promises.nfcall(fs.readFile, docxPath)
+ return fs.readFile(docxPath)
.then(function(buffer) {
return mammoth.embedStyleMap({buffer: buffer}, "p => h1");
})
@@ -141,7 +140,7 @@ test('embedded style map can be written using toBuffer() and then read', functio
test('embedded style map can be written using toArrayBuffer() and then read', function() {
var docxPath = path.join(__dirname, "test-data/single-paragraph.docx");
- return promises.nfcall(fs.readFile, docxPath)
+ return fs.readFile(docxPath)
.then(function(buffer) {
return mammoth.embedStyleMap({buffer: buffer}, "p => h1");
})
@@ -158,7 +157,7 @@ test('embedded style map can be written using toArrayBuffer() and then read', fu
test('embedded style map can be retrieved', function() {
var docxPath = path.join(__dirname, "test-data/single-paragraph.docx");
- return promises.nfcall(fs.readFile, docxPath)
+ return fs.readFile(docxPath)
.then(function(buffer) {
return mammoth.embedStyleMap({buffer: buffer}, "p => h1");
})
@@ -495,7 +494,7 @@ test('extractRawText only retains raw text', function() {
test('extractRawText can use .docx files represented by a Buffer', function() {
var docxPath = path.join(__dirname, "test-data/single-paragraph.docx");
- return promises.nfcall(fs.readFile, docxPath)
+ return fs.readFile(docxPath)
.then(function(buffer) {
return mammoth.extractRawText({buffer: buffer});
})