Welcome to mirror list, hosted at ThFree Co, Russian Federation.

help_page_helper_spec.js « helpers « frontend « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 09c1a113a96e3c6644b38733178a3b56dcaa6131 (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
25
26
27
28
29
import { helpPagePath } from '~/helpers/help_page_helper';

describe('help page helper', () => {
  it.each`
    relative_url_root | path                         | anchor                  | expected
    ${undefined}      | ${'administration/index'}    | ${undefined}            | ${'/help/administration/index'}
    ${''}             | ${'administration/index'}    | ${undefined}            | ${'/help/administration/index'}
    ${'/'}            | ${'administration/index'}    | ${undefined}            | ${'/help/administration/index'}
    ${'/gitlab'}      | ${'administration/index'}    | ${undefined}            | ${'/gitlab/help/administration/index'}
    ${'/gitlab/'}     | ${'administration/index'}    | ${undefined}            | ${'/gitlab/help/administration/index'}
    ${undefined}      | ${'administration/index'}    | ${undefined}            | ${'/help/administration/index'}
    ${'/'}            | ${'administration/index'}    | ${undefined}            | ${'/help/administration/index'}
    ${''}             | ${'administration/index.md'} | ${undefined}            | ${'/help/administration/index.md'}
    ${''}             | ${'administration/index.md'} | ${'installing-gitlab'}  | ${'/help/administration/index.md#installing-gitlab'}
    ${''}             | ${'administration/index'}    | ${'installing-gitlab'}  | ${'/help/administration/index#installing-gitlab'}
    ${''}             | ${'administration/index'}    | ${'#installing-gitlab'} | ${'/help/administration/index#installing-gitlab'}
    ${''}             | ${'/administration/index'}   | ${undefined}            | ${'/help/administration/index'}
    ${''}             | ${'administration/index/'}   | ${undefined}            | ${'/help/administration/index/'}
    ${''}             | ${'/administration/index/'}  | ${undefined}            | ${'/help/administration/index/'}
    ${'/'}            | ${'/administration/index'}   | ${undefined}            | ${'/help/administration/index'}
  `(
    'generates correct URL when path is `$path`, relative url is `$relative_url_root` and anchor is `$anchor`',
    ({ relative_url_root, anchor, path, expected }) => {
      window.gon = { relative_url_root };

      expect(helpPagePath(path, { anchor })).toBe(expected);
    },
  );
});