Commit 27d7092b authored by Scott Hampton's avatar Scott Hampton

Fix project_ids query param

I initially created the project_ids query param
using a different method for handling arrays.
I should have gone the simpler path of just
using a comma separated list.
parent baec1a87
export const getProjectIdQueryParams = projects =>
projects.map(project => `project_ids[]=${project.id}`).join('&');
`project_ids=${projects.map(project => project.id).join(',')}`;
---
title: Fix project_ids query param for downloading coverage CSV report
merge_request: 42497
author:
type: fixed
......@@ -90,7 +90,7 @@ describe('Group repository analytics app', () => {
});
it('renders primary action as a link with one project ID as a parameter', () => {
const expectedPath = `${groupAnalyticsCoverageReportsPathWithDates}&project_ids[]=${groupProjectsData[0].id}`;
const expectedPath = `${groupAnalyticsCoverageReportsPathWithDates}&project_ids=${groupProjectsData[0].id}`;
expect(findCodeCoverageDownloadButton().attributes('href')).toBe(expectedPath);
});
......@@ -111,7 +111,7 @@ describe('Group repository analytics app', () => {
});
describe('when selecting a date range', () => {
const projectIdParams = '&project_ids[]=1&project_ids[]=2';
const projectIdParams = '&project_ids=1,2';
it.each`
date | expected
......
......@@ -4,7 +4,7 @@ describe('group repository analytics util functions', () => {
describe('getProjectIdQueryParams', () => {
it('returns query param string project ids', () => {
const projects = [{ id: 1 }, { id: 2 }];
const expectedString = 'project_ids[]=1&project_ids[]=2';
const expectedString = 'project_ids=1,2';
expect(getProjectIdQueryParams(projects)).toBe(expectedString);
});
......
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