2021-07-21 02:08:41 -04:00
|
|
|
import { initJiraConnect } from '~/jira_connect/subscriptions';
|
2021-04-14 11:09:04 -04:00
|
|
|
|
2021-07-21 02:08:41 -04:00
|
|
|
jest.mock('~/jira_connect/subscriptions/utils', () => ({
|
2021-02-02 07:10:15 -05:00
|
|
|
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');
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|