Skip to content

Commit

Permalink
Test readFileSync with utf-8
Browse files Browse the repository at this point in the history
  • Loading branch information
tschaub committed Sep 26, 2024
1 parent a9c484d commit 9c87858
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions test/lib/fs.readFile.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit 9c87858

Please sign in to comment.