Skip to content

Commit 60ec5f9

Browse files
committed
fix(auth, useUserAccessGroup): document auth/keychain-error, add test coverage
The update to firebase-ios-sdk v7.8.0 which fixed an underlying useUserAccessGroup issue exposed an error in the E2E test that covers our wrapper for the method when it started returning an error in a legitimately incorrect usage. This patches up the test case and documents the error that may be thrown Fixes #5007
1 parent 79b4380 commit 60ec5f9

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

packages/auth/e2e/auth.e2e.js

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,8 +1045,11 @@ describe('auth()', function () {
10451045
});
10461046

10471047
describe('useUserAccessGroup()', function () {
1048-
it('should return "null" on successful keychain implementation', async function () {
1049-
const successfulKeychain = await firebase.auth().useUserAccessGroup('mysecretkeychain');
1048+
// Android simply does Promise.resolve, that is sufficient for this test multi-platform
1049+
it('should return "null" when accessing a group that exists', async function () {
1050+
const successfulKeychain = await firebase
1051+
.auth()
1052+
.useUserAccessGroup('YYX2P3XVJ7.com.invertase.testing'); // iOS signing team is YYX2P3XVJ7
10501053

10511054
should.not.exist(successfulKeychain);
10521055

@@ -1055,5 +1058,17 @@ describe('auth()', function () {
10551058

10561059
should.not.exist(resetKeychain);
10571060
});
1061+
1062+
it('should throw when requesting an inaccessible group', async function () {
1063+
// Android will never throw, so this test is iOS only
1064+
if (device.getPlatform() === 'ios') {
1065+
try {
1066+
await firebase.auth().useUserAccessGroup('there.is.no.way.this.group.exists');
1067+
throw new Error('Should have thrown an error for inaccessible group');
1068+
} catch (e) {
1069+
e.message.should.containEql('auth/keychain-error');
1070+
}
1071+
}
1072+
});
10581073
});
10591074
});

packages/auth/lib/index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1638,6 +1638,7 @@ export namespace FirebaseAuthTypes {
16381638
*
16391639
* @platform ios
16401640
*
1641+
* @error auth/keychain-error Thrown if you attempt to access an inaccessible keychain
16411642
* @param userAccessGroup A string of the keychain id i.e. "TEAMID.com.example.group1"
16421643
*/
16431644
useUserAccessGroup(userAccessGroup: string): Promise<null>;

0 commit comments

Comments
 (0)