aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/apps/issues/__tests__
diff options
context:
space:
mode:
authorstanislavh <stanislav.honcharov@sonarsource.com>2023-10-27 15:51:27 +0200
committersonartech <sonartech@sonarsource.com>2023-11-08 20:02:52 +0000
commita1be2cd1286ff3a24fc27d9c9a387069f5eafb91 (patch)
tree72f1828893ff5829da5a2dcb86128105b0911c49 /server/sonar-web/src/main/js/apps/issues/__tests__
parent01a084c37da6150434a250334d933ea0443c06a2 (diff)
downloadsonarqube-a1be2cd1286ff3a24fc27d9c9a387069f5eafb91.tar.gz
sonarqube-a1be2cd1286ff3a24fc27d9c9a387069f5eafb91.zip
SONAR-20871 Add new status facet in issues list
Diffstat (limited to 'server/sonar-web/src/main/js/apps/issues/__tests__')
-rw-r--r--server/sonar-web/src/main/js/apps/issues/__tests__/IssuesApp-Filtering-it.tsx14
-rw-r--r--server/sonar-web/src/main/js/apps/issues/__tests__/utils-test.ts75
2 files changed, 69 insertions, 20 deletions
diff --git a/server/sonar-web/src/main/js/apps/issues/__tests__/IssuesApp-Filtering-it.tsx b/server/sonar-web/src/main/js/apps/issues/__tests__/IssuesApp-Filtering-it.tsx
index 527b152307d..ce0e9931252 100644
--- a/server/sonar-web/src/main/js/apps/issues/__tests__/IssuesApp-Filtering-it.tsx
+++ b/server/sonar-web/src/main/js/apps/issues/__tests__/IssuesApp-Filtering-it.tsx
@@ -86,17 +86,11 @@ describe('issues app filtering', () => {
await user.click(ui.mainScopeFilter.get());
expect(ui.issueItem4.query()).not.toBeInTheDocument();
- // Resolution
- await user.click(ui.resolutionFacet.get());
- await user.click(ui.fixedResolutionFilter.get());
- expect(ui.issueItem2.query()).not.toBeInTheDocument();
-
// Check that filters were applied as expected
expect(ui.issueItem6.get()).toBeInTheDocument();
// Status
- await user.click(ui.statusFacet.get());
-
+ await user.click(ui.simpleStatusFacet.get());
await user.click(ui.openStatusFilter.get());
expect(ui.issueItem6.query()).not.toBeInTheDocument(); // Issue 6 should vanish
@@ -106,9 +100,6 @@ describe('issues app filtering', () => {
await user.keyboard('{/Control}');
expect(ui.issueItem6.get()).toBeInTheDocument(); // Issue 6 should come back
- // Clear resolution filter
- await user.click(ui.clearResolutionFacet.get());
-
// Rule
await user.click(ui.ruleFacet.get());
await user.click(screen.getByRole('checkbox', { name: 'other' }));
@@ -154,7 +145,6 @@ describe('issues app filtering', () => {
await user.click(ui.clearIssueTypeFacet.get());
await user.click(ui.clearSeverityFacet.get());
await user.click(ui.clearScopeFacet.get());
- await user.click(ui.clearStatusFacet.get());
await user.click(ui.clearRuleFacet.get());
await user.click(ui.clearTagFacet.get());
await user.click(ui.clearProjectFacet.get());
@@ -360,7 +350,7 @@ describe('issues app when reindexing', () => {
expect(ui.resolutionFacet.query()).not.toBeInTheDocument();
expect(ui.ruleFacet.query()).not.toBeInTheDocument();
expect(ui.scopeFacet.query()).not.toBeInTheDocument();
- expect(ui.statusFacet.query()).not.toBeInTheDocument();
+ expect(ui.simpleStatusFacet.query()).not.toBeInTheDocument();
expect(ui.tagFacet.query()).not.toBeInTheDocument();
// Indexation message
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 398f7b9b791..7f55fb9c1e2 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
@@ -22,6 +22,7 @@ import {
SoftwareImpactSeverity,
SoftwareQuality,
} from '../../../types/clean-code-taxonomy';
+import { IssueSimpleStatus } from '../../../types/issues';
import { SecurityStandard } from '../../../types/security';
import {
parseQuery,
@@ -62,15 +63,13 @@ describe('serialize/deserialize', () => {
'owaspAsvs-4.0': ['2'],
owaspAsvsLevel: '2',
projects: ['a', 'b'],
- resolutions: ['a', 'b'],
- resolved: true,
rules: ['a', 'b'],
sort: 'rules',
scopes: ['a', 'b'],
severities: ['a', 'b'],
inNewCodePeriod: true,
sonarsourceSecurity: ['a', 'b'],
- statuses: ['a', 'b'],
+ simpleStatuses: [IssueSimpleStatus.Accepted, IssueSimpleStatus.Confirmed],
tags: ['a', 'b'],
types: ['a', 'b'],
}),
@@ -97,14 +96,13 @@ describe('serialize/deserialize', () => {
'owaspAsvs-4.0': '2',
owaspAsvsLevel: '2',
projects: 'a,b',
- resolutions: 'a,b',
rules: 'a,b',
s: 'rules',
scopes: 'a,b',
inNewCodePeriod: 'true',
severities: 'a,b',
sonarsourceSecurity: 'a,b',
- statuses: 'a,b',
+ simpleStatuses: 'ACCEPTED,CONFIRMED',
tags: 'a,b',
types: 'a,b',
});
@@ -146,18 +144,79 @@ describe('serialize/deserialize', () => {
'pciDss-3.2': [],
'pciDss-4.0': [],
projects: [],
- resolutions: [],
- resolved: true,
rules: [],
scopes: [],
severities: ['CRITICAL', 'MAJOR'],
sonarsourceSecurity: [],
sort: '',
- statuses: [],
+ simpleStatuses: [],
tags: [],
types: [],
});
});
+
+ it('should map deprecated status and resolution query to new simple statuses', () => {
+ expect(parseQuery({ statuses: 'OPEN' }).simpleStatuses).toEqual([IssueSimpleStatus.Open]);
+ expect(parseQuery({ statuses: 'REOPENED' }).simpleStatuses).toEqual([IssueSimpleStatus.Open]);
+ expect(parseQuery({ statuses: 'CONFIRMED' }).simpleStatuses).toEqual([
+ IssueSimpleStatus.Confirmed,
+ ]);
+ expect(parseQuery({ statuses: 'RESOLVED' }).simpleStatuses).toEqual([
+ IssueSimpleStatus.Fixed,
+ IssueSimpleStatus.Accepted,
+ IssueSimpleStatus.FalsePositive,
+ ]);
+ expect(parseQuery({ statuses: 'OPEN,REOPENED' }).simpleStatuses).toEqual([
+ IssueSimpleStatus.Open,
+ ]);
+ expect(parseQuery({ statuses: 'OPEN,CONFIRMED' }).simpleStatuses).toEqual([
+ IssueSimpleStatus.Open,
+ IssueSimpleStatus.Confirmed,
+ ]);
+
+ // Resolutions
+ expect(parseQuery({ resolutions: 'FALSE-POSITIVE' }).simpleStatuses).toEqual([
+ IssueSimpleStatus.FalsePositive,
+ ]);
+ expect(parseQuery({ resolutions: 'WONTFIX' }).simpleStatuses).toEqual([
+ IssueSimpleStatus.Accepted,
+ ]);
+ expect(parseQuery({ resolutions: 'REMOVED' }).simpleStatuses).toEqual([
+ IssueSimpleStatus.Fixed,
+ ]);
+ expect(parseQuery({ resolutions: 'REMOVED,WONTFIX,FALSE-POSITIVE' }).simpleStatuses).toEqual([
+ IssueSimpleStatus.Fixed,
+ IssueSimpleStatus.Accepted,
+ IssueSimpleStatus.FalsePositive,
+ ]);
+
+ // Both statuses and resolutions
+ expect(
+ parseQuery({ resolutions: 'FALSE-POSITIVE', statuses: 'RESOLVED' }).simpleStatuses,
+ ).toEqual([IssueSimpleStatus.FalsePositive]);
+ expect(parseQuery({ resolutions: 'WONTFIX', statuses: 'RESOLVED' }).simpleStatuses).toEqual([
+ IssueSimpleStatus.Accepted,
+ ]);
+
+ // With resolved=false
+ expect(
+ parseQuery({ resolutions: 'WONTFIX', statuses: 'RESOLVED', resolved: 'false' })
+ .simpleStatuses,
+ ).toEqual([IssueSimpleStatus.Accepted, IssueSimpleStatus.Open, IssueSimpleStatus.Confirmed]);
+ expect(parseQuery({ statuses: 'OPEN', resolved: 'false' }).simpleStatuses).toEqual([
+ IssueSimpleStatus.Open,
+ ]);
+
+ // With simple status
+ expect(
+ parseQuery({
+ resolutions: 'WONTFIX',
+ statuses: 'RESOLVED',
+ resolved: 'false',
+ simpleStatuses: 'FIXED',
+ }).simpleStatuses,
+ ).toEqual([IssueSimpleStatus.Fixed]);
+ });
});
describe('shouldOpenStandardsFacet', () => {