Commit ea4b9d1e authored by Natalia Tepluhina's avatar Natalia Tepluhina

Merge branch '215130-fix-project-id-query-params' into 'master'

Fix project_ids query param

Closes #215130

See merge request gitlab-org/gitlab!42497
parents ee7e7ac4 27d7092b
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