diff --git a/test/SyncAsyncFileSystemDecorator.test.js b/test/SyncAsyncFileSystemDecorator.test.js index 200b5c8..b9ace3f 100644 --- a/test/SyncAsyncFileSystemDecorator.test.js +++ b/test/SyncAsyncFileSystemDecorator.test.js @@ -4,7 +4,7 @@ const fs = require("fs"); const path = require("path"); const SyncAsyncFileSystemDecorator = require("../lib/SyncAsyncFileSystemDecorator"); -describe("SyncAsyncFileSystemDecorator stat", function () { +describe("SyncAsyncFileSystemDecorator stat", function () { it("should use options when they're provided", function (done) { const decoratedFs = new SyncAsyncFileSystemDecorator(fs); decoratedFs.stat( @@ -38,3 +38,42 @@ describe("SyncAsyncFileSystemDecorator stat", function () { ); }); }); + +describe("SyncAsyncFileSystemDecorator lstat", function () { + it("should use options when they're provided", function (done) { + const decoratedFs = new SyncAsyncFileSystemDecorator(fs); + if (decoratedFs.lstat) { + decoratedFs.lstat( + path.join(__dirname, "fixtures", "decorated-fs", "exists.js"), + { bigint: true }, + function (error, result) { + expect(error).toBeNull(); + expect(result).toHaveProperty("size"); + expect(result).toHaveProperty("birthtime"); + expect( + typeof (/** @type {import("fs").BigIntStats} */ (result).size) + ).toEqual("bigint"); + done(); + } + ); + } + }); + + it("should work correctly when no options provided", function (done) { + const decoratedFs = new SyncAsyncFileSystemDecorator(fs); + if (decoratedFs.lstat) { + decoratedFs.lstat( + path.join(__dirname, "fixtures", "decorated-fs", "exists.js"), + function (error, result) { + expect(error).toBeNull(); + expect(result).toHaveProperty("size"); + expect(result).toHaveProperty("birthtime"); + expect( + typeof (/** @type {import("fs").Stats} */ (result).size) + ).toEqual("number"); + done(); + } + ); + } + }); +});