Commit 1631fca2 authored by Alexandru Croitor's avatar Alexandru Croitor

Fix burnup guideline

Fix missing burnup guideline on milestone start date.
Fix burnup guieline for milestones that have zero issues
on start date.
parent 800d80a1
......@@ -76,8 +76,10 @@ export default {
},
];
if (series[0] && series[0].data.length >= 2) {
const idealStart = [this.startDate, data[0][1]];
if (data.length > 0) {
const zeroStart = [this.startDate, 0];
const firstNonZero = data.find((dataObj) => dataObj[1] !== 0) || zeroStart;
const idealStart = [this.startDate, firstNonZero[1]];
const idealEnd = [this.dueDate, 0];
const idealData = [idealStart, idealEnd];
......
......@@ -35,10 +35,10 @@ describe('burndown_chart', () => {
expect(findChart().exists()).toBe(true);
});
describe('with single point', () => {
describe('with no points', () => {
it('does not show guideline', () => {
createComponent({
openIssuesCount: [{ '2019-08-07T00:00:00.000Z': 100 }],
openIssuesCount: [],
});
const data = wrapper.vm.dataSeries;
......@@ -47,6 +47,30 @@ describe('burndown_chart', () => {
});
});
describe('with single point and zero issues', () => {
it('shows guideline', () => {
createComponent({
openIssuesCount: [{ '2019-08-07T00:00:00.000Z': 0 }],
});
const data = wrapper.vm.dataSeries;
expect(data).toHaveLength(2);
expect(data[1].name).toBe('Guideline');
});
});
describe('with single point', () => {
it('shows guideline', () => {
createComponent({
openIssuesCount: [{ '2019-08-07T00:00:00.000Z': 100 }],
});
const data = wrapper.vm.dataSeries;
expect(data).toHaveLength(2);
expect(data[1].name).toBe('Guideline');
});
});
describe('with multiple points', () => {
beforeEach(() => {
createComponent({
......
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