diff options
| author | Michael Williamson <mike@zwobble.org> | 2026-09-16 23:08:58 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2026-09-16 23:09:31 +0100 |
| commit | 36d98ebbd6463899737008eaa5147449c9d8e7f2 (patch) | |
| tree | 80adf97bc0394495432aae6d31f805dd8c2f2b3e /test/docx/files.tests.js | |
| parent | 0d13c71b3b8d4adb8d59e5e586f6e5f1a284107d (diff) | |
Prefer fs.promises to promisfying fs functions
Diffstat (limited to 'test/docx/files.tests.js')
| -rw-r--r-- | test/docx/files.tests.js | 9 |
1 files changed, 3 insertions, 6 deletions
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); }); }); |
