summaryrefslogtreecommitdiff
path: root/spec/frontend/jira_connect/subscriptions/index_spec.js
blob: 786f3b4a7d389b5063568d09679a647db9d2069a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import { initJiraConnect } from '~/jira_connect/subscriptions';

jest.mock('~/jira_connect/subscriptions/utils', () => ({
  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');
      });
    });
  });
});