From 7a019abb1742f5170123845efedba167ad1596a3 Mon Sep 17 00:00:00 2001 From: Kun Qian <kunqian@jihulab.com> Date: Wed, 19 Jul 2023 00:39:13 +0800 Subject: [PATCH] Add no hard coded url eslint rules for spec files --- .eslintrc.yml | 26 ++++++++++++++++--- .../javascripts/lib/utils/url_utility.js | 1 + .../subscription_activation_errors_spec.js | 5 ++-- ee/spec/frontend/ai/tanuki_bot/mock_data.js | 7 ++--- .../resource_links_list_item_spec.js.snap | 2 +- .../linked_resources/components/mock_data.js | 8 +++--- .../linked_resources/components/utils_spec.js | 3 ++- .../learn_gitlab_section_link_spec.js | 3 ++- .../learn_gitlab/components/mock_data.js | 8 +++--- .../order_summary/summary_details_spec.js | 5 ++-- .../components/checkout/order_summary_spec.js | 5 ++-- .../components/statistics_card_spec.js | 3 ++- spec/frontend/ci/pipeline_editor/mock_data.js | 3 ++- spec/frontend/ci/pipeline_new/mock_data.js | 8 +++--- .../components/job/sidebar_detail_row_spec.js | 3 ++- spec/frontend/lib/utils/url_utility_spec.js | 1 + .../components/markdown/toolbar_spec.js | 3 ++- .../whats_new/components/feature_spec.js | 4 +-- 18 files changed, 68 insertions(+), 30 deletions(-) diff --git a/.eslintrc.yml b/.eslintrc.yml index 956758255cb94..f65875f5ef5d2 100644 --- a/.eslintrc.yml +++ b/.eslintrc.yml @@ -119,11 +119,17 @@ rules: message: 'Use directive at ~/vue_shared/directives/safe_html.js instead.' - selector: Literal[value=/docs.gitlab.+\u002Fee/] message: 'No hard coded url, use `DOCS_URL_IN_EE_DIR` in `jh_else_ce/lib/utils/url_utility`' - - selector: Literal[value=/(?=.*docs.gitlab.*)(?=^(?!.*\u002Fee\b).*$)/] + - selector: TemplateElement[value.cooked=/docs.gitlab.+\u002Fee/] + message: 'No hard coded url, use `DOCS_URL_IN_EE_DIR` in `jh_else_ce/lib/utils/url_utility`' + - selector: Literal[value=/(?=.*docs.gitlab.*)(?!.*\u002Fee\b.*)/] + message: 'No hard coded url, use `DOCS_URL` in `jh_else_ce/lib/utils/url_utility`' + - selector: TemplateElement[value.cooked=/(?=.*docs.gitlab.*)(?!.*\u002Fee\b.*)/] message: 'No hard coded url, use `DOCS_URL` in `jh_else_ce/lib/utils/url_utility`' - - selector: Literal[value=/(?=.*about.gitlab.*)(?=^(?!.*\u002Fblog\b).*$)/] + - selector: Literal[value=/(?=.*about.gitlab.*)(?!.*\u002Fblog\b.*)/] + message: 'No hard coded url, use `PROMO_URL` in `jh_else_ce/lib/utils/url_utility`' + - selector: TemplateElement[value.cooked=/(?=.*about.gitlab.*)(?!.*\u002Fblog\b.*)/] message: 'No hard coded url, use `PROMO_URL` in `jh_else_ce/lib/utils/url_utility`' - - selector: TemplateLiteral[expressions.0.name=DOCS_URL] > TemplateElement[value.cooked=/\u002Fjh/] + - selector: TemplateLiteral[expressions.0.name=DOCS_URL] > TemplateElement[value.cooked=/\u002Fjh|\u002Fee/] message: '`/ee` or `/jh` path found in docs url, use `DOCS_URL_IN_EE_DIR` in `jh_else_ce/lib/utils/url_utility`' no-restricted-imports: - error @@ -165,6 +171,20 @@ overrides: message: Avoid asserting disabled attribute exact value, because Vue.js 2 and Vue.js 3 renders it differently. Use toBeDefined / toBeUndefined instead - selector: MemberExpression[object.object.name='Vue'][object.property.name='config'][property.name='errorHandler'] message: 'Use setErrorHandler/resetVueErrorHandler from helpers/set_vue_error_handler.js instead.' + - selector: Literal[value=/docs.gitlab.+\u002Fee/] + message: 'No hard coded url, use `DOCS_URL_IN_EE_DIR` in `jh_else_ce/lib/utils/url_utility`' + - selector: TemplateElement[value.cooked=/docs.gitlab.+\u002Fee/] + message: 'No hard coded url, use `DOCS_URL_IN_EE_DIR` in `jh_else_ce/lib/utils/url_utility`' + - selector: Literal[value=/(?=.*docs.gitlab.*)(?!.*\u002Fee\b.*)/] + message: 'No hard coded url, use `DOCS_URL` in `jh_else_ce/lib/utils/url_utility`' + - selector: TemplateElement[value.cooked=/(?=.*docs.gitlab.*)(?!.*\u002Fee\b.*)/] + message: 'No hard coded url, use `DOCS_URL` in `jh_else_ce/lib/utils/url_utility`' + - selector: Literal[value=/(?=.*about.gitlab.*)(?!.*\u002Fblog\b.*)/] + message: 'No hard coded url, use `PROMO_URL` in `jh_else_ce/lib/utils/url_utility`' + - selector: TemplateElement[value.cooked=/(?=.*about.gitlab.*)(?!.*\u002Fblog\b.*)/] + message: 'No hard coded url, use `PROMO_URL` in `jh_else_ce/lib/utils/url_utility`' + - selector: TemplateLiteral[expressions.0.name=DOCS_URL] > TemplateElement[value.cooked=/\u002Fjh|\u002Fee/] + message: '`/ee` or `/jh` path found in docs url, use `DOCS_URL_IN_EE_DIR` in `jh_else_ce/lib/utils/url_utility`' no-unsanitized/method: off no-unsanitized/property: off - files: diff --git a/app/assets/javascripts/lib/utils/url_utility.js b/app/assets/javascripts/lib/utils/url_utility.js index 85740117c00cb..2aa1f65bed789 100644 --- a/app/assets/javascripts/lib/utils/url_utility.js +++ b/app/assets/javascripts/lib/utils/url_utility.js @@ -20,6 +20,7 @@ export const PROMO_HOST = `about.${DOMAIN}`; // about.gitlab.com // About Gitlab default url export const PROMO_URL = `https://${PROMO_HOST}`; +// eslint-disable-next-line no-restricted-syntax export const DOCS_URL_IN_EE_DIR = `${DOCS_URL}/ee`; // Reset the cursor in a Regex so that multiple uses before a recompile don't fail diff --git a/ee/spec/frontend/admin/subscriptions/show/components/subscription_activation_errors_spec.js b/ee/spec/frontend/admin/subscriptions/show/components/subscription_activation_errors_spec.js index e8df7583e2b04..16b4be7792b91 100644 --- a/ee/spec/frontend/admin/subscriptions/show/components/subscription_activation_errors_spec.js +++ b/ee/spec/frontend/admin/subscriptions/show/components/subscription_activation_errors_spec.js @@ -14,13 +14,14 @@ import { SUBSCRIPTION_INSUFFICIENT_TRUE_UP_SERVER_ERROR_REGEX, } from 'ee/admin/subscriptions/show/constants'; import { extendedWrapper } from 'helpers/vue_test_utils_helper'; +import { PROMO_URL } from 'jh_else_ce/lib/utils/url_utility'; const GENERAL_ERROR_MESSAGE = 'A fake error'; -const SUBSCRIPTION_OVERAGES_SERVER_ERROR = `This GitLab installation currently has 22 active users, exceeding this license's limit of 18 by 4 users. Please add a license for at least 22 users or contact sales at https://about.gitlab.com/sales/`; +const SUBSCRIPTION_OVERAGES_SERVER_ERROR = `This GitLab installation currently has 22 active users, exceeding this license's limit of 18 by 4 users. Please add a license for at least 22 users or contact sales at ${PROMO_URL}/sales/`; const EXPECTED_SUBSCRIPTION_OVERAGES_CLIENTSIDE_ERROR = `Your current GitLab installation has 22 active users, which exceeds your new subscription seat count of 18 by 4. To activate your new subscription, purchase an additional 4 seats, or deactivate or block 4 users. For further assistance, contact GitLab support.`; -const SUBSCRIPTION_INSUFFICIENT_TRUE_UP_SERVER_ERROR = `You have applied a True-up for 1 user but you need one for 4 users. Please contact sales at https://about.gitlab.com/sales/`; +const SUBSCRIPTION_INSUFFICIENT_TRUE_UP_SERVER_ERROR = `You have applied a True-up for 1 user but you need one for 4 users. Please contact sales at ${PROMO_URL}/sales/`; const EXPECTED_SUBSCRIPTION_INSUFFICIENT_TRUE_UP_CLIENTSIDE_ERROR = `You have applied a true-up for 1 user but you need one for 4 users. To pay for seat overages, contact your sales representative. For further assistance, contact GitLab support.`; describe('SubscriptionActivationErrors', () => { diff --git a/ee/spec/frontend/ai/tanuki_bot/mock_data.js b/ee/spec/frontend/ai/tanuki_bot/mock_data.js index fed7ee89cf512..3b6d978c48c1f 100644 --- a/ee/spec/frontend/ai/tanuki_bot/mock_data.js +++ b/ee/spec/frontend/ai/tanuki_bot/mock_data.js @@ -1,22 +1,23 @@ import { MESSAGE_TYPES, SOURCE_TYPES } from 'ee/ai/tanuki_bot/constants'; +import { PROMO_URL } from 'jh_else_ce/lib/utils/url_utility'; export const MOCK_SOURCE_TYPES = { HANDBOOK: { title: 'GitLab Handbook', source_type: SOURCE_TYPES.HANDBOOK.value, - source_url: 'https://about.gitlab.com/handbook/', + source_url: `${PROMO_URL}/handbook/`, }, DOC: { stage: 'Mock Stage', group: 'Mock Group', source_type: SOURCE_TYPES.DOC.value, - source_url: 'https://about.gitlab.com/company/team/', + source_url: `${PROMO_URL}/company/team/`, }, BLOG: { date: '2023-04-21', author: 'Test User', source_type: SOURCE_TYPES.BLOG.value, - source_url: 'https://about.gitlab.com/blog/', + source_url: `${PROMO_URL}/blog/`, }, }; diff --git a/ee/spec/frontend/issuable/linked_resources/components/__snapshots__/resource_links_list_item_spec.js.snap b/ee/spec/frontend/issuable/linked_resources/components/__snapshots__/resource_links_list_item_spec.js.snap index 97cd804a49a8e..86735867787b3 100644 --- a/ee/spec/frontend/issuable/linked_resources/components/__snapshots__/resource_links_list_item_spec.js.snap +++ b/ee/spec/frontend/issuable/linked_resources/components/__snapshots__/resource_links_list_item_spec.js.snap @@ -23,7 +23,7 @@ exports[`ResourceLinkItem template matches the snapshot 1`] = ` <a class="gl-link sortable-link gl-font-weight-normal" - href="http://docs.gitlab.com/incident-info" + href="https://docs.gitlab.com/incident-info" rel="noopener noreferrer" target="_blank" > diff --git a/ee/spec/frontend/issuable/linked_resources/components/mock_data.js b/ee/spec/frontend/issuable/linked_resources/components/mock_data.js index ed378ce188654..3ffd088f5bee1 100644 --- a/ee/spec/frontend/issuable/linked_resources/components/mock_data.js +++ b/ee/spec/frontend/issuable/linked_resources/components/mock_data.js @@ -1,19 +1,21 @@ +import { DOCS_URL } from 'jh_else_ce/lib/utils/url_utility'; + export const mockResourceLinks = [ { id: 'gid://gitlab/IncidentManagement::IssuableResourceLink/1', - link: 'http://docs.gitlab.com/incident-info', + link: `${DOCS_URL}/incident-info`, linkType: 'zoom', linkText: 'Doclink for incident', }, { id: 'gid://gitlab/IncidentManagement::IssuableResourceLink/2', - link: 'http://docs.gitlab.com/incident-info2', + link: `${DOCS_URL}/incident-info2`, linkType: 'zoom', linkText: 'Doclink for incident 2', }, { id: 'gid://gitlab/IncidentManagement::IssuableResourceLink/3', - link: 'http://docs.gitlab.com/incident-info3', + link: `${DOCS_URL}/incident-info3`, linkType: 'zoom', linkText: 'Doclink for incident 3', }, diff --git a/ee/spec/frontend/issuable/linked_resources/components/utils_spec.js b/ee/spec/frontend/issuable/linked_resources/components/utils_spec.js index 5ae7db8809d6b..a07965ca578a7 100644 --- a/ee/spec/frontend/issuable/linked_resources/components/utils_spec.js +++ b/ee/spec/frontend/issuable/linked_resources/components/utils_spec.js @@ -4,6 +4,7 @@ import { identifyLinkType, } from 'ee/linked_resources/components/utils'; import { createAlert } from '~/alert'; +import { DOCS_URL } from 'jh_else_ce/lib/utils/url_utility'; jest.mock('~/alert'); @@ -43,7 +44,7 @@ describe('resource links utils', () => { ${'https://gitlab.slack.com/archives/dummy-id'} | ${'slack'} ${'https://company.slack.com/archives/dummy-id'} | ${'slack'} ${'https://slack.slack.com/messages/dummy-id-2'} | ${'slack'} - ${'https://docs.gitlab.com/doc-page'} | ${'general'} + ${`${DOCS_URL}/doc-page`} | ${'general'} ${'https://random-url.com/doc-page'} | ${'general'} ${'https://google.com/email/gmail'} | ${'general'} ${'https://gitlab.pagerduty.com/incidents/WEOJO'} | ${'pagerduty'} diff --git a/ee/spec/frontend/pages/projects/learn_gitlab/components/learn_gitlab_section_link_spec.js b/ee/spec/frontend/pages/projects/learn_gitlab/components/learn_gitlab_section_link_spec.js index 6657b87afd833..9ddc03aa97a58 100644 --- a/ee/spec/frontend/pages/projects/learn_gitlab/components/learn_gitlab_section_link_spec.js +++ b/ee/spec/frontend/pages/projects/learn_gitlab/components/learn_gitlab_section_link_spec.js @@ -6,6 +6,7 @@ import eventHub from '~/invite_members/event_hub'; import LearnGitlabSectionLink from 'ee/pages/projects/learn_gitlab/components/learn_gitlab_section_link.vue'; import { ACTION_LABELS } from 'ee/pages/projects/learn_gitlab/constants'; import { LEARN_GITLAB } from 'ee/invite_members/constants'; +import { DOCS_URL_IN_EE_DIR } from 'jh_else_ce/lib/utils/url_utility'; const defaultAction = 'gitWrite'; const defaultProps = { @@ -17,7 +18,7 @@ const defaultProps = { }; const openInNewTabProps = { - url: 'https://docs.gitlab.com/ee/user/application_security/security_dashboard/', + url: `${DOCS_URL_IN_EE_DIR}/user/application_security/security_dashboard/`, openInNewTab: true, }; diff --git a/ee/spec/frontend/pages/projects/learn_gitlab/components/mock_data.js b/ee/spec/frontend/pages/projects/learn_gitlab/components/mock_data.js index 4d6415f82724b..fed2d65622785 100644 --- a/ee/spec/frontend/pages/projects/learn_gitlab/components/mock_data.js +++ b/ee/spec/frontend/pages/projects/learn_gitlab/components/mock_data.js @@ -1,3 +1,5 @@ +import { DOCS_URL_IN_EE_DIR } from 'jh_else_ce/lib/utils/url_utility'; + export const testActions = { codeAdded: { url: 'http://example.com/', @@ -48,21 +50,21 @@ export const testActions = { enabled: true, }, licenseScanningRun: { - url: 'https://docs.gitlab.com/ee/foobar/', + url: `${DOCS_URL_IN_EE_DIR}/foobar/`, completed: false, svg: 'http://example.com/images/illustration.svg', enabled: true, openInNewTab: true, }, secureDependencyScanningRun: { - url: 'https://docs.gitlab.com/ee/foobar/', + url: `${DOCS_URL_IN_EE_DIR}/foobar/`, completed: false, svg: 'http://example.com/images/illustration.svg', enabled: true, openInNewTab: true, }, secureDastRun: { - url: 'https://docs.gitlab.com/ee/foobar/', + url: `${DOCS_URL_IN_EE_DIR}/foobar/`, completed: false, svg: 'http://example.com/images/illustration.svg', enabled: true, diff --git a/ee/spec/frontend/subscriptions/buy_addons_shared/components/order_summary/summary_details_spec.js b/ee/spec/frontend/subscriptions/buy_addons_shared/components/order_summary/summary_details_spec.js index beeac303a9240..ef9c3119576ab 100644 --- a/ee/spec/frontend/subscriptions/buy_addons_shared/components/order_summary/summary_details_spec.js +++ b/ee/spec/frontend/subscriptions/buy_addons_shared/components/order_summary/summary_details_spec.js @@ -2,6 +2,7 @@ import { GlSprintf, GlIcon } from '@gitlab/ui'; import SummaryDetails from 'ee/subscriptions/buy_addons_shared/components/order_summary/summary_details.vue'; import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; import { useFakeDate } from 'helpers/fake_date'; +import { PROMO_URL } from 'jh_else_ce/lib/utils/url_utility'; describe('SummaryDetails', () => { useFakeDate(2021, 0, 16); @@ -50,7 +51,7 @@ describe('SummaryDetails', () => { it('displays a help link', () => { expect(findVatHelpLink().attributes('href')).toBe( - 'https://about.gitlab.com/handbook/tax/#indirect-taxes-management', + `${PROMO_URL}/handbook/tax/#indirect-taxes-management`, ); }); @@ -137,7 +138,7 @@ describe('SummaryDetails', () => { it('displays a help link', () => { expect(findVatHelpLink().attributes('href')).toBe( - 'https://about.gitlab.com/handbook/tax/#indirect-taxes-management', + `${PROMO_URL}/handbook/tax/#indirect-taxes-management`, ); }); diff --git a/ee/spec/frontend/subscriptions/new/components/checkout/order_summary_spec.js b/ee/spec/frontend/subscriptions/new/components/checkout/order_summary_spec.js index 8da3000c98f51..85b238bfb3c64 100644 --- a/ee/spec/frontend/subscriptions/new/components/checkout/order_summary_spec.js +++ b/ee/spec/frontend/subscriptions/new/components/checkout/order_summary_spec.js @@ -32,6 +32,7 @@ import { mockInvoicePreviewWithPromoOffer, mockInvoicePreviewWithoutPromoOffer, } from 'ee_jest/subscriptions/mock_data'; +import { PROMO_URL } from 'jh_else_ce/lib/utils/url_utility'; jest.mock('~/alert'); @@ -385,7 +386,7 @@ describe('Order Summary', () => { it('contains a help link', () => { expect(findTaxHelpLink().attributes('href')).toBe( - 'https://about.gitlab.com/handbook/tax/#indirect-taxes-management', + `${PROMO_URL}/handbook/tax/#indirect-taxes-management`, ); }); }); @@ -413,7 +414,7 @@ describe('Order Summary', () => { it('contains a help link', () => { expect(findTaxHelpLink().attributes('href')).toBe( - 'https://about.gitlab.com/handbook/tax/#indirect-taxes-management', + `${PROMO_URL}/handbook/tax/#indirect-taxes-management`, ); }); }); diff --git a/ee/spec/frontend/usage_quotas/components/statistics_card_spec.js b/ee/spec/frontend/usage_quotas/components/statistics_card_spec.js index eaa028296925a..51fa3b80fe7b9 100644 --- a/ee/spec/frontend/usage_quotas/components/statistics_card_spec.js +++ b/ee/spec/frontend/usage_quotas/components/statistics_card_spec.js @@ -1,6 +1,7 @@ import { GlLink, GlButton, GlProgressBar, GlSkeletonLoader } from '@gitlab/ui'; import { shallowMount } from '@vue/test-utils'; import StatisticsCard from 'ee/usage_quotas/components/statistics_card.vue'; +import { DOCS_URL } from 'jh_else_ce/lib/utils/url_utility'; describe('StatisticsCard', () => { let wrapper; @@ -95,7 +96,7 @@ describe('StatisticsCard', () => { it('renders help link if description and helpLink props are passed', () => { const description = 'description value'; - const helpLink = 'https://docs.gitlab.com'; + const helpLink = `${DOCS_URL}`; const helpTooltip = 'Tooltip text'; createComponent({ description, helpLink, helpTooltip }); diff --git a/spec/frontend/ci/pipeline_editor/mock_data.js b/spec/frontend/ci/pipeline_editor/mock_data.js index a3294cdc269ba..66dbc031bd014 100644 --- a/spec/frontend/ci/pipeline_editor/mock_data.js +++ b/spec/frontend/ci/pipeline_editor/mock_data.js @@ -1,5 +1,6 @@ import { CI_CONFIG_STATUS_INVALID, CI_CONFIG_STATUS_VALID } from '~/ci/pipeline_editor/constants'; import { unwrapStagesWithNeeds } from '~/pipelines/components/unwrapping_utils'; +import { DOCS_URL_IN_EE_DIR } from 'jh_else_ce/lib/utils/url_utility'; export const commonOptions = { ciConfigPath: '/ci/config', @@ -601,7 +602,7 @@ export const mockErrors = [ ]; export const mockWarnings = [ - '"jobs:multi_project_job may allow multiple pipelines to run for a single action due to `rules:when` clause with no `workflow:rules` - read more: https://docs.gitlab.com/ee/ci/troubleshooting.html#pipeline-warnings"', + `"jobs:multi_project_job may allow multiple pipelines to run for a single action due to \`rules:when\` clause with no \`workflow:rules\` - read more: ${DOCS_URL_IN_EE_DIR}/ci/troubleshooting.html#pipeline-warnings"`, ]; export const mockCommitCreateResponse = { diff --git a/spec/frontend/ci/pipeline_new/mock_data.js b/spec/frontend/ci/pipeline_new/mock_data.js index 76a88f632981d..72a491bb946c0 100644 --- a/spec/frontend/ci/pipeline_new/mock_data.js +++ b/spec/frontend/ci/pipeline_new/mock_data.js @@ -1,3 +1,5 @@ +import { DOCS_URL_IN_EE_DIR } from 'jh_else_ce/lib/utils/url_utility'; + export const mockFilteredRefs = { Branches: ['branch-1'], Tags: ['1.0.0', '1.1.0'], @@ -28,9 +30,9 @@ export const mockError = { 'test job: chosen stage does not exist; available stages are .pre, build, test, deploy, .post', ], warnings: [ - 'jobs:build1 may allow multiple pipelines to run for a single action due to `rules:when` clause with no `workflow:rules` - read more: https://docs.gitlab.com/ee/ci/troubleshooting.html#pipeline-warnings', - 'jobs:build2 may allow multiple pipelines to run for a single action due to `rules:when` clause with no `workflow:rules` - read more: https://docs.gitlab.com/ee/ci/troubleshooting.html#pipeline-warnings', - 'jobs:build3 may allow multiple pipelines to run for a single action due to `rules:when` clause with no `workflow:rules` - read more: https://docs.gitlab.com/ee/ci/troubleshooting.html#pipeline-warnings', + `jobs:build1 may allow multiple pipelines to run for a single action due to \`rules:when\` clause with no \`workflow:rules\` - read more: ${DOCS_URL_IN_EE_DIR}/ci/troubleshooting.html#pipeline-warnings`, + `jobs:build2 may allow multiple pipelines to run for a single action due to \`rules:when\` clause with no \`workflow:rules\` - read more: ${DOCS_URL_IN_EE_DIR}/ci/troubleshooting.html#pipeline-warnings`, + `jobs:build3 may allow multiple pipelines to run for a single action due to \`rules:when\` clause with no \`workflow:rules\` - read more: ${DOCS_URL_IN_EE_DIR}/ci/troubleshooting.html#pipeline-warnings`, ], total_warnings: 7, }; diff --git a/spec/frontend/jobs/components/job/sidebar_detail_row_spec.js b/spec/frontend/jobs/components/job/sidebar_detail_row_spec.js index fd27004816a7c..546f5392caff8 100644 --- a/spec/frontend/jobs/components/job/sidebar_detail_row_spec.js +++ b/spec/frontend/jobs/components/job/sidebar_detail_row_spec.js @@ -1,12 +1,13 @@ import { shallowMountExtended } from 'helpers/vue_test_utils_helper'; import SidebarDetailRow from '~/jobs/components/job/sidebar/sidebar_detail_row.vue'; +import { DOCS_URL } from 'jh_else_ce/lib/utils/url_utility'; describe('Sidebar detail row', () => { let wrapper; const title = 'this is the title'; const value = 'this is the value'; - const helpUrl = 'https://docs.gitlab.com/runner/register/index.html'; + const helpUrl = `${DOCS_URL}/runner/register/index.html`; const path = 'path/to/value'; const findHelpLink = () => wrapper.findByTestId('job-sidebar-help-link'); diff --git a/spec/frontend/lib/utils/url_utility_spec.js b/spec/frontend/lib/utils/url_utility_spec.js index 0f32eaa4ca6a2..a78c59e5cf078 100644 --- a/spec/frontend/lib/utils/url_utility_spec.js +++ b/spec/frontend/lib/utils/url_utility_spec.js @@ -1107,6 +1107,7 @@ describe('URL utility', () => { describe('defaultPromoUrl', () => { it('Gitlab about page url', () => { + // eslint-disable-next-line no-restricted-syntax const url = 'https://about.gitlab.com'; expect(urlUtils.PROMO_URL).toBe(url); diff --git a/spec/frontend/vue_shared/components/markdown/toolbar_spec.js b/spec/frontend/vue_shared/components/markdown/toolbar_spec.js index 5bf11ff2b2678..90d8ce3b500a3 100644 --- a/spec/frontend/vue_shared/components/markdown/toolbar_spec.js +++ b/spec/frontend/vue_shared/components/markdown/toolbar_spec.js @@ -3,6 +3,7 @@ import Toolbar from '~/vue_shared/components/markdown/toolbar.vue'; import EditorModeSwitcher from '~/vue_shared/components/markdown/editor_mode_switcher.vue'; import { updateText } from '~/lib/utils/text_markdown'; import { setHTMLFixture, resetHTMLFixture } from 'helpers/fixtures'; +import { PROMO_URL } from 'jh_else_ce/lib/utils/url_utility'; jest.mock('~/lib/utils/text_markdown'); @@ -98,7 +99,7 @@ describe('toolbar', () => { expect.objectContaining({ tag: `### Rich text editor -Try out **styling** _your_ content right here or read the [direction](https://about.gitlab.com/direction/plan/knowledge/content_editor/).`, +Try out **styling** _your_ content right here or read the [direction](${PROMO_URL}/direction/plan/knowledge/content_editor/).`, textArea: document.querySelector('textarea'), cursorOffset: 0, wrap: false, diff --git a/spec/frontend/whats_new/components/feature_spec.js b/spec/frontend/whats_new/components/feature_spec.js index d69ac2803dfda..0898e85003e79 100644 --- a/spec/frontend/whats_new/components/feature_spec.js +++ b/spec/frontend/whats_new/components/feature_spec.js @@ -1,5 +1,6 @@ import { shallowMount } from '@vue/test-utils'; import Feature from '~/whats_new/components/feature.vue'; +import { DOCS_URL_IN_EE_DIR } from 'jh_else_ce/lib/utils/url_utility'; describe("What's new single feature", () => { /** @type {import("@vue/test-utils").Wrapper} */ @@ -13,8 +14,7 @@ describe("What's new single feature", () => { 'self-managed': true, 'gitlab-com': true, available_in: ['Ultimate'], - documentation_link: - 'https://docs.gitlab.com/ee/user/project/settings/#compliance-pipeline-configuration', + documentation_link: `${DOCS_URL_IN_EE_DIR}/user/project/settings/#compliance-pipeline-configuration`, image_url: 'https://img.youtube.com/vi/upLJ_equomw/hqdefault.jpg', published_at: '2021-04-22T00:00:00.000Z', release: '13.11', -- GitLab