@@ -309,3 +309,114 @@ Deno.test("if 3 folders are returned when the where clause has isFile <> true",
309309 ] ;
310310 assertArrayIncludes < string > ( names , expectedNames ) ;
311311} ) ;
312+
313+ Deno . test ( "if the 'root.txt' is returned when the where clause has name = 'root.txt'" , async ( ) => {
314+ const query : IQuery = {
315+ type : "select" ,
316+ fields : [ "*" ] ,
317+ from : "root" ,
318+ where : {
319+ conditions : [
320+ {
321+ left : "name" ,
322+ op : "Equal" ,
323+ right : "root.txt" ,
324+ } ,
325+ ] ,
326+ } ,
327+ } ;
328+
329+ const result = await select ( query ) ;
330+
331+ assert ( result . length === 1 ) ;
332+ assertEquals ( result [ 0 ] . name , "root.txt" ) ;
333+ assertEquals ( result [ 0 ] . isDirectory , false ) ;
334+ assertEquals ( result [ 0 ] . isFile , true ) ;
335+ } ) ;
336+
337+ Deno . test ( "if a folder is returned when the where clause has name = 'test_folder_with_folder'" , async ( ) => {
338+ const query : IQuery = {
339+ type : "select" ,
340+ fields : [ "*" ] ,
341+ from : "root" ,
342+ where : {
343+ conditions : [
344+ {
345+ left : "name" ,
346+ op : "Equal" ,
347+ right : "test_folder_with_folder" ,
348+ } ,
349+ ] ,
350+ } ,
351+ } ;
352+
353+ const result = await select ( query ) ;
354+
355+ assert ( result . length === 1 ) ;
356+ assertEquals ( result [ 0 ] . name , "test_folder_with_folder" ) ;
357+ assertEquals ( result [ 0 ] . isDirectory , true ) ;
358+ assertEquals ( result [ 0 ] . isFile , false ) ;
359+ } ) ;
360+
361+
362+
363+
364+
365+
366+
367+
368+ Deno . test ( "if the 'root.txt' is not returned when the where clause has name <> 'root.txt'" , async ( ) => {
369+ const query : IQuery = {
370+ type : "select" ,
371+ fields : [ "*" ] ,
372+ from : "root" ,
373+ where : {
374+ conditions : [
375+ {
376+ left : "name" ,
377+ op : "Different" ,
378+ right : "root.txt" ,
379+ } ,
380+ ] ,
381+ } ,
382+ } ;
383+
384+ const result = await select ( query ) ;
385+
386+ assert ( result . length === 3 ) ;
387+ const names = result . map ( ( i ) => i . name as string ) ;
388+ const expectedNames = [
389+ "test_folder_with_file" ,
390+ "test_folder_with_files" ,
391+ "test_folder_with_folder" ,
392+ ] ;
393+ assertArrayIncludes < string > ( names , expectedNames ) ;
394+ } ) ;
395+
396+ Deno . test ( "if a folder is returned when the where clause has name <> 'test_folder_with_folder'" , async ( ) => {
397+ const query : IQuery = {
398+ type : "select" ,
399+ fields : [ "*" ] ,
400+ from : "root" ,
401+ where : {
402+ conditions : [
403+ {
404+ left : "name" ,
405+ op : "Different" ,
406+ right : "test_folder_with_folder" ,
407+ } ,
408+ ] ,
409+ } ,
410+ } ;
411+
412+ const result = await select ( query ) ;
413+
414+ assert ( result . length === 3 ) ;
415+ const names = result . map ( ( i ) => i . name as string ) ;
416+ const expectedNames = [
417+ "test_folder_with_file" ,
418+ "test_folder_with_files" ,
419+ "root.txt" ,
420+ ] ;
421+ assertArrayIncludes < string > ( names , expectedNames ) ;
422+ } ) ;
0 commit comments