diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-15 21:08:43 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-10-15 21:08:43 +0300 |
commit | 316fbf9f95dcdd16775f0339415572c3195eea92 (patch) | |
tree | 40d86a896fc0ff8ce22fbed7e5e3dffc2adceebf /spec/frontend/vue_shared/components/user_popover | |
parent | d9e71b0d412fb9d2d7fc8b00dddac21617eaaf19 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/vue_shared/components/user_popover')
-rw-r--r-- | spec/frontend/vue_shared/components/user_popover/user_popover_spec.js | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/spec/frontend/vue_shared/components/user_popover/user_popover_spec.js b/spec/frontend/vue_shared/components/user_popover/user_popover_spec.js index b43bb6b10e0..c208d7b0226 100644 --- a/spec/frontend/vue_shared/components/user_popover/user_popover_spec.js +++ b/spec/frontend/vue_shared/components/user_popover/user_popover_spec.js @@ -21,6 +21,9 @@ describe('User Popover Component', () => { let wrapper; beforeEach(() => { + window.gon.features = { + securityAutoFix: true, + }; loadFixtures(fixtureTemplate); }); @@ -28,6 +31,7 @@ describe('User Popover Component', () => { wrapper.destroy(); }); + const findByTestId = testid => wrapper.find(`[data-testid="${testid}"]`); const findUserStatus = () => wrapper.find('.js-user-status'); const findTarget = () => document.querySelector('.js-user-link'); @@ -196,4 +200,30 @@ describe('User Popover Component', () => { expect(findUserStatus().exists()).toBe(false); }); }); + + describe('security bot', () => { + const SECURITY_BOT_USER = { + ...DEFAULT_PROPS.user, + name: 'GitLab Security Bot', + username: 'GitLab-Security-Bot', + websiteUrl: '/security/bot/docs', + }; + const findSecurityBotDocsLink = () => findByTestId('user-popover-bot-docs-link'); + + it("shows a link to the bot's documentation", () => { + createWrapper({ user: SECURITY_BOT_USER }); + const securityBotDocsLink = findSecurityBotDocsLink(); + expect(securityBotDocsLink.exists()).toBe(true); + expect(securityBotDocsLink.attributes('href')).toBe(SECURITY_BOT_USER.websiteUrl); + }); + + it('does not show the link if the feature flag is disabled', () => { + window.gon.features = { + securityAutoFix: false, + }; + createWrapper({ user: SECURITY_BOT_USER }); + + expect(findSecurityBotDocsLink().exists()).toBe(false); + }); + }); }); |