Commit 72d86be5 authored by Brandon Labuschagne's avatar Brandon Labuschagne

Conditionally render MR throughput milestone

Fix a bug where the MR Analytics Throughput table
renders column data which does not exist, resulting
in a console error.
parent 53a4483b
......@@ -220,7 +220,9 @@ export default {
</template>
<template #cell(milestone)="{ item }">
<div :data-testid="$options.testIds.MILESTONE">{{ item.milestone.title }}</div>
<div v-if="item.milestone" :data-testid="$options.testIds.MILESTONE">
{{ item.milestone.title }}
</div>
</template>
<template #cell(pipelines)="{ item }">
......
......@@ -199,8 +199,20 @@ describe('ThroughputTable', () => {
expect(findCol(TEST_IDS.TIME_TO_MERGE).text()).toBe('4 minutes');
});
it('displays the correct milestone', () => {
expect(findCol(TEST_IDS.MILESTONE).text()).toBe('v1.0');
it('does not display a milestone if not present', () => {
expect(findCol(TEST_IDS.MILESTONE).exists()).toBe(false);
});
it('displays the correct milestone when available', async () => {
const title = 'v1.0';
additionalData({
milestone: { title },
});
await wrapper.vm.$nextTick();
expect(findCol(TEST_IDS.MILESTONE).text()).toBe(title);
});
it('displays the correct pipeline count', () => {
......
......@@ -63,7 +63,7 @@ export const throughputTableData = [
createdAt: '2020-08-06T16:53:50Z',
mergedAt: '2020-08-06T16:57:53Z',
webUrl: 'http://127.0.0.1:3001/gitlab-org/gitlab-shell/-/merge_requests/11',
milestone: { title: 'v1.0' },
milestone: null,
assignees: {
nodes: [
{
......
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