Chatwoot/app/javascript/dashboard/helper/spec/URLHelper.spec.js
Sojan Jose 19ab0fe108
Chore: Scope URLs with account_id (#601)
* Chore: Enable Users to create multiple accounts

Addresses: #402
- migrations to split roles and other attributes from users table
- make changes in code to accommodate this change

Co-authored-by: Pranav Raj Sreepuram <pranavrajs@gmail.com>
2020-03-09 23:27:10 +05:30

25 lines
866 B
JavaScript

import { frontendURL, conversationUrl } from '../URLHelper';
describe('#URL Helpers', () => {
describe('conversationUrl', () => {
it('should return direct conversation URL if activeInbox is nil', () => {
expect(conversationUrl(1, undefined, 1)).toBe(
'accounts/1/conversations/1'
);
});
it('should return ibox conversation URL if activeInbox is not nil', () => {
expect(conversationUrl(1, 2, 1)).toBe(
'accounts/1/inbox/2/conversations/1'
);
});
});
describe('frontendURL', () => {
it('should return url without params if params passed is nil', () => {
expect(frontendURL('main', null)).toBe('/app/main');
});
it('should return url without params if params passed is not nil', () => {
expect(frontendURL('main', { ping: 'pong' })).toBe('/app/main?ping=pong');
});
});
});