From 36d98ebbd6463899737008eaa5147449c9d8e7f2 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Wed, 16 Sep 2026 23:08:58 +0100 Subject: Prefer fs.promises to promisfying fs functions --- test/docx/files.tests.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'test/docx') diff --git a/test/docx/files.tests.js b/test/docx/files.tests.js index 5ddda4a..91de108 100644 --- a/test/docx/files.tests.js +++ b/test/docx/files.tests.js @@ -1,16 +1,13 @@ var path = require("path"); -var fs = require("fs"); var assert = require("assert"); -var promises = require("../../lib/promises"); var Files = require("../../lib/docx/files").Files; var uriToPath = require("../../lib/docx/files").uriToPath; +var fs = require("../../lib/fs"); var testing = require("../testing"); var test = require("../test")(module); -var readFile = promises.promisify(fs.readFile.bind(fs)); - test("Files", { "when external file access is disabled then reading file raises error": function() { @@ -24,7 +21,7 @@ test("Files", { var filePath = path.resolve(testing.testPath("tiny-picture.png")); var files = new Files({externalFileAccess: true}); return files.read("file:///" + filePath.replace(/^\//, ""), "base64").then(function(contents) { - return readFile(filePath, "base64").then(function(expectedContents) { + return fs.readFile(filePath, "base64").then(function(expectedContents) { assert.deepEqual(contents, expectedContents); }); }); @@ -37,7 +34,7 @@ test("Files", { relativeToFile: testing.testPath("./document.docx") }); return files.read("tiny-picture.png", "base64").then(function(contents) { - return readFile(filePath, "base64").then(function(expectedContents) { + return fs.readFile(filePath, "base64").then(function(expectedContents) { assert.deepEqual(contents, expectedContents); }); }); -- cgit v1.2.3