Skip to content

Commit

Permalink
test(auth, multi-tenant): add multi-tenant E2E test
Browse files Browse the repository at this point in the history
this exposed most of the errors fixed in prior commits, and allows you
to see that setTenantId is working, but cannot be used against the emulator
and we have no valid tenant id in our test project so it is unknown if this
is truly working
  • Loading branch information
mikehardy committed Mar 12, 2021
1 parent 4f6d426 commit 5ba603c
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions packages/auth/e2e/auth.e2e.js
Original file line number Diff line number Diff line change
Expand Up @@ -1071,4 +1071,25 @@ describe('auth()', function () {
}
});
});

describe('setTenantId()', function () {
it('should return null if tenantId unset', function () {
should.not.exist(firebase.auth().tenantId);
});

// multi-tenant is not supported by the firebase auth emulator, and requires a valid multi-tenant tenantid
// After setting this, next user creation will result in internal error on emulator, or auth/invalid-tenant-id live
// it('should return tenantId correctly after setting', async function () {
// await firebase.auth().setTenantId('testTenantId');
// firebase.auth().tenantId.should.equal('testTenantId');
// });
// it('user should have tenant after setting tenantId', async function () {
// await firebase.auth().setTenantId('userTestTenantId');
// firebase.auth().tenantId.should.equal('userTestTenantId');
// const random = Utils.randString(12, '#a');
// const email = `${random}@${random}.com`;
// const userCredential = await firebase.auth().createUserWithEmailAndPassword(email, random);
// userCredential.user.tenantId.should.equal('userTestTenantId');
// });
});
});

1 comment on commit 5ba603c

@vercel
Copy link

@vercel vercel bot commented on 5ba603c Mar 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.