@@ -1512,6 +1512,50 @@ describe('storage', function () {
15121512 } ) ;
15131513 } ) ;
15141514
1515+ describe ( 'bucket hierarchical namespace' , async ( ) => {
1516+ let bucket : Bucket ;
1517+
1518+ beforeEach ( ( ) => {
1519+ bucket = storage . bucket ( generateName ( ) ) ;
1520+ } ) ;
1521+
1522+ afterEach ( async ( ) => {
1523+ try {
1524+ await bucket . delete ( ) ;
1525+ } catch {
1526+ //Ignore errors
1527+ }
1528+ } ) ;
1529+
1530+ it ( 'should create a bucket without hierarchical namespace enabled (implicit)' , async ( ) => {
1531+ await storage . createBucket ( bucket . name ) ;
1532+ const [ metadata ] = await bucket . getMetadata ( ) ;
1533+ assert . strictEqual ( metadata . hierarchicalNamespace , undefined ) ;
1534+ } ) ;
1535+
1536+ it ( 'should create a bucket without hierarchical namespace enabled (explicit)' , async ( ) => {
1537+ await storage . createBucket ( bucket . name , {
1538+ hierarchicalNamespace : { enabled : false } ,
1539+ } ) ;
1540+ const [ metadata ] = await bucket . getMetadata ( ) ;
1541+ assert . strictEqual ( metadata . hierarchicalNamespace , undefined ) ;
1542+ } ) ;
1543+
1544+ it ( 'should create a bucket with hierarchical namespace enabled' , async ( ) => {
1545+ await storage . createBucket ( bucket . name , {
1546+ hierarchicalNamespace : { enabled : true } ,
1547+ iamConfiguration : {
1548+ uniformBucketLevelAccess : {
1549+ enabled : true ,
1550+ } ,
1551+ } ,
1552+ } ) ;
1553+ const [ metadata ] = await bucket . getMetadata ( ) ;
1554+ assert ( metadata . hierarchicalNamespace ) ;
1555+ assert . strictEqual ( metadata . hierarchicalNamespace . enabled , true ) ;
1556+ } ) ;
1557+ } ) ;
1558+
15151559 describe ( 'bucket retention policies' , ( ) => {
15161560 describe ( 'bucket' , ( ) => {
15171561 it ( 'should create a bucket with a retention policy' , async ( ) => {
0 commit comments