diff options
Diffstat (limited to 'spec/frontend/vue_shared/components/user_popover/user_popover_spec.js')
-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); + }); + }); }); |