2021-10-27 15:23:28 +05:30
|
|
|
import { initJiraConnect } from '~/jira_connect/subscriptions';
|
2021-03-11 19:13:27 +05:30
|
|
|
|
2021-10-27 15:23:28 +05:30
|
|
|
jest.mock('~/jira_connect/subscriptions/utils', () => ({
|
2021-03-11 19:13:27 +05:30
|
|
|
getLocation: jest.fn().mockResolvedValue('test/location'),
|
|
|
|
}));
|
|
|
|
|
|
|
|
describe('initJiraConnect', () => {
|
|
|
|
beforeEach(async () => {
|
|
|
|
setFixtures(`
|
|
|
|
<a class="js-jira-connect-sign-in" href="https://gitlab.com">Sign In</a>
|
|
|
|
<a class="js-jira-connect-sign-in" href="https://gitlab.com">Another Sign In</a>
|
|
|
|
`);
|
|
|
|
|
|
|
|
await initJiraConnect();
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('Sign in links', () => {
|
|
|
|
it('have `return_to` query parameter', () => {
|
|
|
|
Array.from(document.querySelectorAll('.js-jira-connect-sign-in')).forEach((el) => {
|
|
|
|
expect(el.href).toContain('return_to=test/location');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|