import { shallowMount } from '@vue/test-utils'; import { GlButton } from '@gitlab/ui'; import PinnedLinks from '~/issue_show/components/pinned_links.vue'; import { STATUS_PAGE_PUBLISHED, JOIN_ZOOM_MEETING } from '~/issue_show/constants'; const plainZoomUrl = 'https://zoom.us/j/123456789'; const plainStatusUrl = 'https://status.com'; describe('PinnedLinks', () => { let wrapper; const findButtons = () => wrapper.findAll(GlButton); const createComponent = props => { wrapper = shallowMount(PinnedLinks, { propsData: { zoomMeetingUrl: '', publishedIncidentUrl: '', ...props, }, }); }; it('displays Zoom link', () => { createComponent({ zoomMeetingUrl: `Zoom`, }); expect( findButtons() .at(0) .text(), ).toBe(JOIN_ZOOM_MEETING); }); it('displays Status link', () => { createComponent({ publishedIncidentUrl: `Status`, }); expect( findButtons() .at(0) .text(), ).toBe(STATUS_PAGE_PUBLISHED); }); it('does not render if there are no links', () => { createComponent({ zoomMeetingUrl: '', publishedIncidentUrl: '', }); expect(findButtons()).toHaveLength(0); }); });