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