Skip to content

Commit

Permalink
TST: Make sure listAll behaves as expected when the user is not autho…
Browse files Browse the repository at this point in the history
…rized
  • Loading branch information
TPXP authored and greenbull-tpathier committed Dec 18, 2020
1 parent b1ae0dc commit 8859913
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions packages/storage/e2e/StorageReference.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,20 @@ describe('storage() -> StorageReference', function() {
result.prefixes.length.should.be.greaterThan(0);
result.prefixes[0].constructor.name.should.eql('StorageReference');
});

it('should not crash if the user is not allowed to list the directory', async function() {
const storageReference = firebase.storage().ref('/forbidden');
try {
await storageReference.listAll();
return Promise.reject(new Error('listAll on a forbidden directory succeeded'));
} catch(error) {
error.code.should.equal('storage/unauthorized');
error.message.should.equal(
'[storage/unauthorized] User is not authorized to perform the desired action.',
);
return Promise.resolve();
}
});
});

describe('updateMetadata', function() {
Expand Down

0 comments on commit 8859913

Please sign in to comment.