chore: Add support for conversation_id in SSO params (#5228)

This commit is contained in:
Pranav Raj S 2022-08-09 00:13:06 +05:30 committed by GitHub
parent 4b1bb65c92
commit 27a9806817
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 54 additions and 14 deletions

View file

@ -74,17 +74,37 @@ describe('#URL Helpers', () => {
describe('getLoginRedirectURL', () => {
it('should return correct Account URL if account id is present', () => {
expect(
getLoginRedirectURL('7500', {
accounts: [{ id: 7500, name: 'Test Account 7500' }],
getLoginRedirectURL({
ssoAccountId: '7500',
user: {
accounts: [{ id: 7500, name: 'Test Account 7500' }],
},
})
).toBe('/app/accounts/7500/dashboard');
});
it('should return default URL if account id is not present', () => {
expect(getLoginRedirectURL('7500', {})).toBe('/app/');
it('should return correct conversation URL if account id and conversationId is present', () => {
expect(
getLoginRedirectURL('7500', {
accounts: [{ id: '7501', name: 'Test Account 7501' }],
getLoginRedirectURL({
ssoAccountId: '7500',
ssoConversationId: '752',
user: {
accounts: [{ id: 7500, name: 'Test Account 7500' }],
},
})
).toBe('/app/accounts/7500/conversations/752');
});
it('should return default URL if account id is not present', () => {
expect(getLoginRedirectURL({ ssoAccountId: '7500', user: {} })).toBe(
'/app/'
);
expect(
getLoginRedirectURL({
ssoAccountId: '7500',
user: {
accounts: [{ id: '7501', name: 'Test Account 7501' }],
},
})
).toBe('/app/accounts/7501/dashboard');
expect(getLoginRedirectURL('7500', null)).toBe('/app/');