Skip to content

Commit cc5bde7

Browse files
test: lstat
1 parent 570337b commit cc5bde7

File tree

1 file changed

+36
-1
lines changed

1 file changed

+36
-1
lines changed

test/SyncAsyncFileSystemDecorator.test.js

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const fs = require("fs");
44
const path = require("path");
55
const SyncAsyncFileSystemDecorator = require("../lib/SyncAsyncFileSystemDecorator");
66

7-
describe("SyncAsyncFileSystemDecorator stat", function () {
7+
describe("SyncAsyncFileSystemDecorator stat", function () {
88
it("should use options when they're provided", function (done) {
99
const decoratedFs = new SyncAsyncFileSystemDecorator(fs);
1010
decoratedFs.stat(
@@ -38,3 +38,38 @@ describe("SyncAsyncFileSystemDecorator stat", function () {
3838
);
3939
});
4040
});
41+
42+
describe("SyncAsyncFileSystemDecorator lstat", function () {
43+
it("should use options when they're provided", function (done) {
44+
const decoratedFs = new SyncAsyncFileSystemDecorator(fs);
45+
decoratedFs.lstat(
46+
path.join(__dirname, "fixtures", "decorated-fs", "exists.js"),
47+
{ bigint: true },
48+
function (error, result) {
49+
expect(error).toBeNull();
50+
expect(result).toHaveProperty("size");
51+
expect(result).toHaveProperty("birthtime");
52+
expect(
53+
typeof (/** @type {import("fs").BigIntStats} */ (result).size)
54+
).toEqual("bigint");
55+
done();
56+
}
57+
);
58+
});
59+
60+
it("should work correctly when no options provided", function (done) {
61+
const decoratedFs = new SyncAsyncFileSystemDecorator(fs);
62+
decoratedFs.lstat(
63+
path.join(__dirname, "fixtures", "decorated-fs", "exists.js"),
64+
function (error, result) {
65+
expect(error).toBeNull();
66+
expect(result).toHaveProperty("size");
67+
expect(result).toHaveProperty("birthtime");
68+
expect(
69+
typeof (/** @type {import("fs").Stats} */ (result).size)
70+
).toEqual("number");
71+
done();
72+
}
73+
);
74+
});
75+
});

0 commit comments

Comments
 (0)