diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-07-15 12:09:35 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-07-15 12:09:35 +0300 |
commit | 32e53ae7d739e9457ef81ba4a441a3acb4446240 (patch) | |
tree | 33ddf07292cdbf9fb0be6b54e73360947bffe81a /spec/frontend/ide | |
parent | 01ef10900ad5ce2efea5abe6bbbc6d118b9ee6f8 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/ide')
-rw-r--r-- | spec/frontend/ide/components/ide_project_header_spec.js | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/spec/frontend/ide/components/ide_project_header_spec.js b/spec/frontend/ide/components/ide_project_header_spec.js new file mode 100644 index 00000000000..fc39651c661 --- /dev/null +++ b/spec/frontend/ide/components/ide_project_header_spec.js @@ -0,0 +1,44 @@ +import { shallowMount } from '@vue/test-utils'; +import IDEProjectHeader from '~/ide/components/ide_project_header.vue'; +import ProjectAvatar from '~/vue_shared/components/project_avatar.vue'; + +const mockProject = { + name: 'test proj', + avatar_url: 'https://gitlab.com', + path_with_namespace: 'path/with-namespace', + web_url: 'https://gitlab.com/project', +}; + +describe('IDE project header', () => { + let wrapper; + + const findProjectAvatar = () => wrapper.findComponent(ProjectAvatar); + const findProjectLink = () => wrapper.find('[data-testid="go-to-project-link"'); + + const createComponent = () => { + wrapper = shallowMount(IDEProjectHeader, { propsData: { project: mockProject } }); + }; + + afterEach(() => { + wrapper.destroy(); + }); + + describe('template', () => { + beforeEach(() => { + createComponent(); + }); + + it('renders ProjectAvatar with correct props', () => { + expect(findProjectAvatar().props()).toMatchObject({ + projectName: mockProject.name, + projectAvatarUrl: mockProject.avatar_url, + }); + }); + + it('renders a link to the project URL', () => { + const link = findProjectLink(); + expect(link.exists()).toBe(true); + expect(link.attributes('href')).toBe(mockProject.web_url); + }); + }); +}); |