diff options
Diffstat (limited to 'spec/frontend/jira_connect/components/groups_list_item_spec.js')
-rw-r--r-- | spec/frontend/jira_connect/components/groups_list_item_spec.js | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/spec/frontend/jira_connect/components/groups_list_item_spec.js b/spec/frontend/jira_connect/components/groups_list_item_spec.js new file mode 100644 index 00000000000..77577c53cf4 --- /dev/null +++ b/spec/frontend/jira_connect/components/groups_list_item_spec.js @@ -0,0 +1,46 @@ +import { shallowMount } from '@vue/test-utils'; +import { GlAvatar } from '@gitlab/ui'; +import { extendedWrapper } from 'helpers/vue_test_utils_helper'; +import { mockGroup1 } from '../mock_data'; + +import GroupsListItem from '~/jira_connect/components/groups_list_item.vue'; + +describe('GroupsListItem', () => { + let wrapper; + + const createComponent = () => { + wrapper = extendedWrapper( + shallowMount(GroupsListItem, { + propsData: { + group: mockGroup1, + }, + }), + ); + }; + + beforeEach(() => { + createComponent(); + }); + + afterEach(() => { + wrapper.destroy(); + wrapper = null; + }); + + const findGlAvatar = () => wrapper.find(GlAvatar); + const findGroupName = () => wrapper.findByTestId('group-list-item-name'); + const findGroupDescription = () => wrapper.findByTestId('group-list-item-description'); + + it('renders group avatar', () => { + expect(findGlAvatar().exists()).toBe(true); + expect(findGlAvatar().props('src')).toBe(mockGroup1.avatar_url); + }); + + it('renders group name', () => { + expect(findGroupName().text()).toBe(mockGroup1.full_name); + }); + + it('renders group description', () => { + expect(findGroupDescription().text()).toBe(mockGroup1.description); + }); +}); |