Commit d8fa67ba authored by Dave Pisek's avatar Dave Pisek

Reviewer feedback: Minor changes

parent 3a367350
......@@ -16,7 +16,8 @@ export default {
computed: {
commitPath() {
const { projectFullPath, value } = this;
// this ensures an absolute path, as `projectFullPath` can be relative in some cases (e.g.: pipeline security tab)
// `projectFullPath` comes in two flavors: relative (e.g.: `group/project`) and absolute (e.g.: `/group/project`)
// adding a leading slash to the relative path makes sure we always link to an absolute path
const absoluteProjectPath = isRootRelative(projectFullPath)
? projectFullPath
: `/${projectFullPath}`;
......
import { GlLink } from '@gitlab/ui';
import { shallowMount } from '@vue/test-utils';
import Url from 'ee/vulnerabilities/components/generic_report/types/commit.vue';
import Commit from 'ee/vulnerabilities/components/generic_report/types/commit.vue';
const TEST_DATA = {
value: '24922148',
......@@ -10,10 +10,8 @@ describe('ee/vulnerabilities/components/generic_report/types/commit.vue', () =>
let wrapper;
const createWrapper = ({ provide } = {}) => {
return shallowMount(Url, {
propsData: {
...TEST_DATA,
},
return shallowMount(Commit, {
propsData: TEST_DATA,
provide: {
projectFullPath: '',
...provide,
......@@ -28,7 +26,7 @@ describe('ee/vulnerabilities/components/generic_report/types/commit.vue', () =>
});
it.each(['/foo/bar', 'foo/bar'])(
'given `projectFullPath` is "%s" it links links to the absolute path of the commit',
'given `projectFullPath` is "%s" it links to the absolute path of the commit',
(projectFullPath) => {
const absoluteCommitPath = `/foo/bar/-/commit/${TEST_DATA.value}`;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment