aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web
diff options
context:
space:
mode:
authorMathieu Suen <mathieu.suen@sonarsource.com>2022-03-29 14:49:34 +0200
committersonartech <sonartech@sonarsource.com>2022-03-29 20:03:37 +0000
commitaa9f8f3a84f3bc8eb6090e12e63bc4fc3be59e35 (patch)
tree9b5811eb5df565cda939b7ec1b2d96c4ff977be1 /server/sonar-web
parent0abfd426442c11add6328efeb6eade36cb8f210b (diff)
downloadsonarqube-aa9f8f3a84f3bc8eb6090e12e63bc4fc3be59e35.tar.gz
sonarqube-aa9f8f3a84f3bc8eb6090e12e63bc4fc3be59e35.zip
SONAR-16165 Fix multi select of author facet
Diffstat (limited to 'server/sonar-web')
-rw-r--r--server/sonar-web/src/main/js/apps/issues/__tests__/utils-test.ts63
-rw-r--r--server/sonar-web/src/main/js/apps/issues/components/__tests__/IssuesApp-test.tsx1
-rw-r--r--server/sonar-web/src/main/js/apps/issues/utils.ts2
3 files changed, 65 insertions, 1 deletions
diff --git a/server/sonar-web/src/main/js/apps/issues/__tests__/utils-test.ts b/server/sonar-web/src/main/js/apps/issues/__tests__/utils-test.ts
index 91651e35d9d..a220b5fb908 100644
--- a/server/sonar-web/src/main/js/apps/issues/__tests__/utils-test.ts
+++ b/server/sonar-web/src/main/js/apps/issues/__tests__/utils-test.ts
@@ -21,6 +21,7 @@ import { scrollToElement } from '../../../helpers/scrolling';
import { SecurityStandard } from '../../../types/security';
import {
scrollToIssue,
+ serializeQuery,
shouldOpenSonarSourceSecurityFacet,
shouldOpenStandardsChildFacet,
shouldOpenStandardsFacet
@@ -34,6 +35,68 @@ beforeEach(() => {
jest.clearAllMocks();
});
+describe('serialize/deserialize', () => {
+ it('should serlialize correctly', () => {
+ expect(
+ serializeQuery({
+ assigned: true,
+ assignees: ['a', 'b'],
+ author: ['a', 'b'],
+ createdAfter: new Date(1000000),
+ createdAt: 'a',
+ createdBefore: new Date(1000000),
+ createdInLast: 'a',
+ cwe: ['18', '19'],
+ directories: ['a', 'b'],
+ files: ['a', 'b'],
+ issues: ['a', 'b'],
+ languages: ['a', 'b'],
+ owaspTop10: ['a', 'b'],
+ 'owaspTop10-2021': ['a', 'b'],
+ projects: ['a', 'b'],
+ resolutions: ['a', 'b'],
+ resolved: true,
+ rules: ['a', 'b'],
+ sort: 'rules',
+ sansTop25: ['a', 'b'],
+ scopes: ['a', 'b'],
+ severities: ['a', 'b'],
+ sinceLeakPeriod: true,
+ sonarsourceSecurity: ['a', 'b'],
+ statuses: ['a', 'b'],
+ tags: ['a', 'b'],
+ types: ['a', 'b']
+ })
+ ).toStrictEqual({
+ assignees: 'a,b',
+ author: ['a', 'b'],
+ createdAt: 'a',
+ createdBefore: '1970-01-01',
+ createdAfter: '1970-01-01',
+ createdInLast: 'a',
+ cwe: '18,19',
+ directories: 'a,b',
+ files: 'a,b',
+ issues: 'a,b',
+ languages: 'a,b',
+ owaspTop10: 'a,b',
+ 'owaspTop10-2021': 'a,b',
+ projects: 'a,b',
+ resolutions: 'a,b',
+ rules: 'a,b',
+ s: 'rules',
+ sansTop25: 'a,b',
+ scopes: 'a,b',
+ severities: 'a,b',
+ sinceLeakPeriod: 'true',
+ sonarsourceSecurity: 'a,b',
+ statuses: 'a,b',
+ tags: 'a,b',
+ types: 'a,b'
+ });
+ });
+});
+
describe('scrollToIssue', () => {
it('should scroll to the issue', () => {
document.querySelector = jest.fn(() => ({}));
diff --git a/server/sonar-web/src/main/js/apps/issues/components/__tests__/IssuesApp-test.tsx b/server/sonar-web/src/main/js/apps/issues/components/__tests__/IssuesApp-test.tsx
index 5a43255cc15..ff7dfd752ad 100644
--- a/server/sonar-web/src/main/js/apps/issues/components/__tests__/IssuesApp-test.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/components/__tests__/IssuesApp-test.tsx
@@ -173,6 +173,7 @@ it('should handle my issue change properly', () => {
pathname: '/issues',
query: {
id: 'foo',
+ author: [],
myIssues: 'true'
}
});
diff --git a/server/sonar-web/src/main/js/apps/issues/utils.ts b/server/sonar-web/src/main/js/apps/issues/utils.ts
index 4ce712a7825..0805f292f4e 100644
--- a/server/sonar-web/src/main/js/apps/issues/utils.ts
+++ b/server/sonar-web/src/main/js/apps/issues/utils.ts
@@ -123,7 +123,7 @@ export function serializeQuery(query: Query): RawQuery {
const filter = {
assigned: query.assigned ? undefined : 'false',
assignees: serializeStringArray(query.assignees),
- author: serializeStringArray(query.author),
+ author: query.author,
createdAfter: serializeDateShort(query.createdAfter),
createdAt: serializeString(query.createdAt),
createdBefore: serializeDateShort(query.createdBefore),