From 9c87858c9f4b5f9f66e36fde4e6f93b926aef345 Mon Sep 17 00:00:00 2001 From: Tim Schaub Date: Thu, 26 Sep 2024 11:18:10 -0600 Subject: [PATCH] Test readFileSync with utf-8 --- test/lib/fs.readFile.spec.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/lib/fs.readFile.spec.js b/test/lib/fs.readFile.spec.js index 8fe2959..bb2b10d 100644 --- a/test/lib/fs.readFile.spec.js +++ b/test/lib/fs.readFile.spec.js @@ -95,6 +95,11 @@ describe('fs.readFileSync(filename, [options])', function () { }); afterEach(mock.restore); + it('works with utf-8', function () { + const content = fs.readFileSync('path/to/file.txt', 'utf-8').toString(); + assert.equal(content, 'file content'); + }); + it('allows a file to be read synchronously', function () { const data = fs.readFileSync('path/to/file.txt'); assert.isTrue(Buffer.isBuffer(data));