@@ -547,6 +547,7 @@ mocha.describe('namespace_fs', function() {
547
547
const dir_2 = '/a/b/' ;
548
548
const upload_key_1 = dir_1 + 'upload_key_1/' ;
549
549
const upload_key_2 = dir_2 + 'upload_key_2/' ;
550
+ const upload_key_empty = 'empty_key/' ;
550
551
const data = crypto . randomBytes ( 100 ) ;
551
552
552
553
mocha . before ( async function ( ) {
@@ -558,6 +559,22 @@ mocha.describe('namespace_fs', function() {
558
559
console . log ( 'upload_object with trailing / response' , inspect ( upload_res ) ) ;
559
560
} ) ;
560
561
562
+ mocha . it ( 'get empty content dir' , async function ( ) {
563
+ await ns_tmp . upload_object ( {
564
+ bucket : upload_bkt ,
565
+ key : upload_key_empty ,
566
+ source_stream : buffer_utils . buffer_to_read_stream ( crypto . randomBytes ( 0 ) ) ,
567
+ size : 0
568
+ } , dummy_object_sdk ) ;
569
+
570
+ const read_res = buffer_utils . write_stream ( ) ;
571
+ await ns_tmp . read_object_stream ( {
572
+ bucket : upload_bkt ,
573
+ key : upload_key_empty ,
574
+ } , dummy_object_sdk , read_res ) ;
575
+ assert ( read_res . writableEnded ) ;
576
+ } ) ;
577
+
561
578
mocha . it ( `delete the path - stop when not empty and key with trailing /` , async function ( ) {
562
579
const upload_res = await ns_tmp . upload_object ( {
563
580
bucket : upload_bkt ,
@@ -574,11 +591,17 @@ mocha.describe('namespace_fs', function() {
574
591
} ) ;
575
592
576
593
mocha . after ( async function ( ) {
577
- const delete_res = await ns_tmp . delete_object ( {
594
+ let delete_res = await ns_tmp . delete_object ( {
578
595
bucket : upload_bkt ,
579
596
key : upload_key_2 ,
580
597
} , dummy_object_sdk ) ;
581
598
console . log ( 'delete_object with trailing / (key 2) response' , inspect ( delete_res ) ) ;
599
+
600
+ delete_res = await ns_tmp . delete_object ( {
601
+ bucket : upload_bkt ,
602
+ key : upload_key_empty ,
603
+ } , dummy_object_sdk ) ;
604
+ console . log ( 'delete_object with trailing / (empty content dir) response' , inspect ( delete_res ) ) ;
582
605
} ) ;
583
606
} ) ;
584
607
0 commit comments