@@ -11,6 +11,7 @@ Deno.test("if an empty array is returned when the folder is missing", async () =
1111 type : "select" ,
1212 fields : [ "*" ] ,
1313 from : "missing-folder" ,
14+ where : null ,
1415 } ;
1516
1617 const result = await select ( query ) ;
@@ -23,6 +24,7 @@ Deno.test("if an empty array is returned when the path is a file", async () => {
2324 type : "select" ,
2425 fields : [ "*" ] ,
2526 from : "select_test.ts" ,
27+ where : null ,
2628 } ;
2729
2830 const result = await select ( query ) ;
@@ -35,11 +37,12 @@ Deno.test("if an existing file entry is returned when the path is a correct fold
3537 type : "select" ,
3638 fields : [ "*" ] ,
3739 from : "root/test_folder_with_file" ,
40+ where : null ,
3841 } ;
3942
4043 const result = await select ( query ) ;
4144
42- assert ( result . length === 1 ) ;
45+ assert ( result . length === 2 ) ;
4346 assertEquals ( result [ 0 ] . name , "a-file.txt" ) ;
4447 assertEquals ( result [ 0 ] . size , 12 ) ;
4548 assertEquals ( result [ 0 ] . isFile , true ) ;
@@ -55,6 +58,7 @@ Deno.test("if an existing directory entry is returned when the path is a correct
5558 type : "select" ,
5659 fields : [ "*" ] ,
5760 from : "root/test_folder_with_folder" ,
61+ where : null ,
5862 } ;
5963
6064 const result = await select ( query ) ;
@@ -68,3 +72,31 @@ Deno.test("if an existing directory entry is returned when the path is a correct
6872 assert ( result [ 0 ] . createdAt ) ;
6973 assert ( result [ 0 ] . modifiedAt ) ;
7074} ) ;
75+
76+ Deno . test ( "if a 1MB file is returned when the where clause is correct" , async ( ) => {
77+ const query : IQuery = {
78+ type : "select" ,
79+ fields : [ "*" ] ,
80+ from : "root/test_folder_with_file" ,
81+ where : {
82+ conditions : [
83+ {
84+ left : "size" ,
85+ op : "GreaterThan" ,
86+ right : 1000000 ,
87+ } ,
88+ ] ,
89+ } ,
90+ } ;
91+
92+ const result = await select ( query ) ;
93+
94+ assert ( result . length === 1 ) ;
95+ assertEquals ( result [ 0 ] . name , "b-file-1MB.txt" ) ;
96+ assertEquals ( result [ 0 ] . isFile , true ) ;
97+ assertEquals ( result [ 0 ] . isDirectory , false ) ;
98+ assertEquals ( result [ 0 ] . isSymlink , false ) ;
99+ assert ( result [ 0 ] . accessedAt ) ;
100+ assert ( result [ 0 ] . createdAt ) ;
101+ assert ( result [ 0 ] . modifiedAt ) ;
102+ } ) ;
0 commit comments