From a8772e5071ff31c89ef20d0609f500ffd1ded12c Mon Sep 17 00:00:00 2001 From: Denis DelGrosso Date: Fri, 5 Aug 2022 17:46:38 +0000 Subject: [PATCH 1/2] tests: remove callback waterfall from make bucket private system test --- system-test/storage.ts | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/system-test/storage.ts b/system-test/storage.ts index 6904081dc..d8d9bb309 100644 --- a/system-test/storage.ts +++ b/system-test/storage.ts @@ -363,22 +363,15 @@ describe('storage', () => { ]); }); - it('should make a bucket private', done => { - bucket.makePublic(err => { - assert.ifError(err); - bucket.makePrivate(err => { - assert.ifError(err); - bucket.acl.get({entity: 'allUsers'}, (err, aclObject) => { - assert.strictEqual((err as ApiError).code, 404); - assert.strictEqual( - (err as ApiError).errors![0].reason, - 'notFound' - ); - assert.strictEqual(aclObject, null); - done(); - }); - }); - }); + it('should make a bucket private', async () => { + try { + await bucket.makePublic(); + await bucket.makePrivate(); + await bucket.acl.get({entity: 'allUsers'}); + } catch (err) { + assert.strictEqual((err as ApiError).code, 404); + assert.strictEqual((err as ApiError).errors![0].reason, 'notFound'); + } }); it('should make files private', async () => { From d20197b2fa7840c647a90a05b39850cc38923918 Mon Sep 17 00:00:00 2001 From: Denis DelGrosso Date: Fri, 5 Aug 2022 17:52:16 +0000 Subject: [PATCH 2/2] cleaner implementation --- system-test/storage.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/system-test/storage.ts b/system-test/storage.ts index d8d9bb309..1b23c00e0 100644 --- a/system-test/storage.ts +++ b/system-test/storage.ts @@ -367,10 +367,12 @@ describe('storage', () => { try { await bucket.makePublic(); await bucket.makePrivate(); - await bucket.acl.get({entity: 'allUsers'}); + assert.rejects(bucket.acl.get({entity: 'allUsers'}), err => { + assert.strictEqual((err as ApiError).code, 404); + assert.strictEqual((err as ApiError).errors![0].reason, 'notFound'); + }); } catch (err) { - assert.strictEqual((err as ApiError).code, 404); - assert.strictEqual((err as ApiError).errors![0].reason, 'notFound'); + assert.ifError(err); } });