aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/helpers/__tests__
diff options
context:
space:
mode:
authorAmbroise C <ambroise.christea@sonarsource.com>2023-09-11 19:25:35 +0200
committersonartech <sonartech@sonarsource.com>2023-09-12 20:02:41 +0000
commit8d5275ca04be8dbb4b4c7cb0068fe3f1320f1554 (patch)
tree73f1aa91e094c9ec92bc312096619ec6e54c87be /server/sonar-web/src/main/js/helpers/__tests__
parentf0e873e18885be912862f5361bd4a77f6f6faac1 (diff)
downloadsonarqube-8d5275ca04be8dbb4b4c7cb0068fe3f1320f1554.tar.gz
sonarqube-8d5275ca04be8dbb4b4c7cb0068fe3f1320f1554.zip
SONAR-20327 Run new version of prettier on all files
Diffstat (limited to 'server/sonar-web/src/main/js/helpers/__tests__')
-rw-r--r--server/sonar-web/src/main/js/helpers/__tests__/branch-like-test.ts6
-rw-r--r--server/sonar-web/src/main/js/helpers/__tests__/code-difference-test.tsx4
-rw-r--r--server/sonar-web/src/main/js/helpers/__tests__/error-test.ts2
-rw-r--r--server/sonar-web/src/main/js/helpers/__tests__/globalMessages-test.ts6
-rw-r--r--server/sonar-web/src/main/js/helpers/__tests__/issues-test.ts2
-rw-r--r--server/sonar-web/src/main/js/helpers/__tests__/l10n-test.ts4
-rw-r--r--server/sonar-web/src/main/js/helpers/__tests__/l10nBundle-test.ts2
-rw-r--r--server/sonar-web/src/main/js/helpers/__tests__/measures-test.ts20
-rw-r--r--server/sonar-web/src/main/js/helpers/__tests__/new-code-definition-test.ts8
-rw-r--r--server/sonar-web/src/main/js/helpers/__tests__/new-code-period-test.ts41
-rw-r--r--server/sonar-web/src/main/js/helpers/__tests__/path-test.ts6
-rw-r--r--server/sonar-web/src/main/js/helpers/__tests__/projects-test.ts2
-rw-r--r--server/sonar-web/src/main/js/helpers/__tests__/qualityGates-test.ts4
-rw-r--r--server/sonar-web/src/main/js/helpers/__tests__/request-test.ts22
-rw-r--r--server/sonar-web/src/main/js/helpers/__tests__/sanitize-test.ts4
-rw-r--r--server/sonar-web/src/main/js/helpers/__tests__/security-standard-test.ts10
-rw-r--r--server/sonar-web/src/main/js/helpers/__tests__/stringify-queryparams-test.ts2
-rw-r--r--server/sonar-web/src/main/js/helpers/__tests__/strings-test.ts10
-rw-r--r--server/sonar-web/src/main/js/helpers/__tests__/tokens-test.ts6
-rw-r--r--server/sonar-web/src/main/js/helpers/__tests__/urls-test.ts82
-rw-r--r--server/sonar-web/src/main/js/helpers/__tests__/users-test.ts16
21 files changed, 131 insertions, 128 deletions
diff --git a/server/sonar-web/src/main/js/helpers/__tests__/branch-like-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/branch-like-test.ts
index 55b52dae5f2..857a966a459 100644
--- a/server/sonar-web/src/main/js/helpers/__tests__/branch-like-test.ts
+++ b/server/sonar-web/src/main/js/helpers/__tests__/branch-like-test.ts
@@ -56,7 +56,7 @@ describe('#getBrancheLikesAsTree', () => {
branch2Pr1,
branch1Pr2,
branch1Pr1,
- ])
+ ]),
).toEqual({
mainBranchTree: {
branch: main,
@@ -107,10 +107,10 @@ describe('#isSameBranchLike', () => {
it('compares pull requests', () => {
expect(
- isSameBranchLike(mockPullRequest({ key: '1234' }), mockPullRequest({ key: '1234' }))
+ isSameBranchLike(mockPullRequest({ key: '1234' }), mockPullRequest({ key: '1234' })),
).toBe(true);
expect(
- isSameBranchLike(mockPullRequest({ key: '1234' }), mockPullRequest({ key: '5678' }))
+ isSameBranchLike(mockPullRequest({ key: '1234' }), mockPullRequest({ key: '5678' })),
).toBe(false);
});
diff --git a/server/sonar-web/src/main/js/helpers/__tests__/code-difference-test.tsx b/server/sonar-web/src/main/js/helpers/__tests__/code-difference-test.tsx
index 1ce732295d8..4b9c4b92fd0 100644
--- a/server/sonar-web/src/main/js/helpers/__tests__/code-difference-test.tsx
+++ b/server/sonar-web/src/main/js/helpers/__tests__/code-difference-test.tsx
@@ -26,7 +26,7 @@ it('should apply diff view correctly', () => {
applyCodeDifferences(container);
// eslint-disable-next-line testing-library/no-container, testing-library/no-node-access
expect(container.getElementsByClassName('code-difference-scrollable')).toMatchSnapshot(
- 'differenciatedCode'
+ 'differenciatedCode',
);
});
@@ -152,6 +152,6 @@ function renderDom(codeSnippet: string) {
dangerouslySetInnerHTML={{
__html: codeSnippet,
}}
- />
+ />,
);
}
diff --git a/server/sonar-web/src/main/js/helpers/__tests__/error-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/error-test.ts
index 8a904ccc0a3..119b3b9d789 100644
--- a/server/sonar-web/src/main/js/helpers/__tests__/error-test.ts
+++ b/server/sonar-web/src/main/js/helpers/__tests__/error-test.ts
@@ -68,7 +68,7 @@ it('should handle weird response types', async () => {
await expect(
throwGlobalError(response).then(() => {
throw new Error('Should throw');
- })
+ }),
).rejects.toBe(response);
});
diff --git a/server/sonar-web/src/main/js/helpers/__tests__/globalMessages-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/globalMessages-test.ts
index 57eab4065ab..3b4f3173a5c 100644
--- a/server/sonar-web/src/main/js/helpers/__tests__/globalMessages-test.ts
+++ b/server/sonar-web/src/main/js/helpers/__tests__/globalMessages-test.ts
@@ -31,7 +31,7 @@ it('should work as expected', () => {
addGlobalErrorMessage('test');
expect(listener1).toHaveBeenCalledWith(
- expect.objectContaining({ text: 'test', level: MessageLevel.Error })
+ expect.objectContaining({ text: 'test', level: MessageLevel.Error }),
);
listener1.mockClear();
@@ -41,9 +41,9 @@ it('should work as expected', () => {
addGlobalSuccessMessage('test');
expect(listener1).toHaveBeenCalledWith(
- expect.objectContaining({ text: 'test', level: MessageLevel.Success })
+ expect.objectContaining({ text: 'test', level: MessageLevel.Success }),
);
expect(listener2).toHaveBeenCalledWith(
- expect.objectContaining({ text: 'test', level: MessageLevel.Success })
+ expect.objectContaining({ text: 'test', level: MessageLevel.Success }),
);
});
diff --git a/server/sonar-web/src/main/js/helpers/__tests__/issues-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/issues-test.ts
index fc4c33e5ddd..bb5763499b9 100644
--- a/server/sonar-web/src/main/js/helpers/__tests__/issues-test.ts
+++ b/server/sonar-web/src/main/js/helpers/__tests__/issues-test.ts
@@ -29,7 +29,7 @@ it('should sort issues correctly by type', () => {
const securityHotspot = mockIssue(false, { type: 'SECURITY_HOTSPOT', key: 'security_hotspot' });
expect(
- sortByType([bug1, codeSmell, bug2, securityHotspot, vulnerability1, vulnerability2])
+ sortByType([bug1, codeSmell, bug2, securityHotspot, vulnerability1, vulnerability2]),
).toEqual([bug1, bug2, vulnerability1, vulnerability2, codeSmell, securityHotspot]);
});
diff --git a/server/sonar-web/src/main/js/helpers/__tests__/l10n-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/l10n-test.ts
index 48e434bd494..64e87dceb02 100644
--- a/server/sonar-web/src/main/js/helpers/__tests__/l10n-test.ts
+++ b/server/sonar-web/src/main/js/helpers/__tests__/l10n-test.ts
@@ -104,7 +104,7 @@ describe('translateWithParameters', () => {
x_apples: '{0}: I have {2} apples in my {1} baskets - {3}',
});
expect(translateWithParameters('x_apples', 1, 2, 3, 4)).toBe(
- '1: I have 3 apples in my 2 baskets - 4'
+ '1: I have 3 apples in my 2 baskets - 4',
);
});
@@ -155,7 +155,7 @@ describe('getLocalizedCategoryMetricName', () => {
'metric.new_code.extra_short_name': 'metric.new_code.extra_short_name_t',
});
expect(getLocalizedCategoryMetricName({ key: 'new_code' })).toBe(
- 'metric.new_code.extra_short_name_t'
+ 'metric.new_code.extra_short_name_t',
);
});
diff --git a/server/sonar-web/src/main/js/helpers/__tests__/l10nBundle-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/l10nBundle-test.ts
index b9c0d5fe414..9538fe1870f 100644
--- a/server/sonar-web/src/main/js/helpers/__tests__/l10nBundle-test.ts
+++ b/server/sonar-web/src/main/js/helpers/__tests__/l10nBundle-test.ts
@@ -65,7 +65,7 @@ describe('#loadL10nBundle', () => {
const bundle = await loadL10nBundle();
expect(bundle).toEqual(
- expect.objectContaining({ locale: cachedBundle.locale, messages: cachedBundle.messages })
+ expect.objectContaining({ locale: cachedBundle.locale, messages: cachedBundle.messages }),
);
});
});
diff --git a/server/sonar-web/src/main/js/helpers/__tests__/measures-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/measures-test.ts
index 2cc7cbc4d09..8781c8d195c 100644
--- a/server/sonar-web/src/main/js/helpers/__tests__/measures-test.ts
+++ b/server/sonar-web/src/main/js/helpers/__tests__/measures-test.ts
@@ -61,13 +61,13 @@ describe('enhanceConditionWithMeasure', () => {
];
expect(
- enhanceConditionWithMeasure(mockQualityGateStatusCondition({ metric: 'bugs' }), measures)
+ enhanceConditionWithMeasure(mockQualityGateStatusCondition({ metric: 'bugs' }), measures),
).toMatchObject({
measure: expect.objectContaining({ metric: expect.objectContaining({ key: 'bugs' }) }),
});
expect(
- enhanceConditionWithMeasure(mockQualityGateStatusCondition({ metric: 'new_bugs' }), measures)
+ enhanceConditionWithMeasure(mockQualityGateStatusCondition({ metric: 'new_bugs' }), measures),
).toMatchObject({
measure: expect.objectContaining({
metric: expect.objectContaining({ key: 'new_bugs' }),
@@ -86,13 +86,13 @@ describe('isPeriodBestValue', () => {
expect(isPeriodBestValue(mockMeasureEnhanced({ period: undefined }))).toBe(false);
expect(
isPeriodBestValue(
- mockMeasureEnhanced({ period: { index: 1, value: '1.0', bestValue: false } })
- )
+ mockMeasureEnhanced({ period: { index: 1, value: '1.0', bestValue: false } }),
+ ),
).toBe(false);
expect(
isPeriodBestValue(
- mockMeasureEnhanced({ period: { index: 1, value: '1.0', bestValue: true } })
- )
+ mockMeasureEnhanced({ period: { index: 1, value: '1.0', bestValue: true } }),
+ ),
).toBe(true);
});
});
@@ -156,16 +156,16 @@ describe('#formatMeasure()', () => {
expect(formatMeasure(50.89, 'PERCENT', { decimals: 2 })).toBe('50.89%');
expect(formatMeasure(50.89, 'PERCENT', { decimals: 3 })).toBe('50.890%');
expect(formatMeasure(50, 'PERCENT', { decimals: 0, omitExtraDecimalZeros: true })).toBe(
- '50.0%'
+ '50.0%',
);
expect(formatMeasure(50, 'PERCENT', { decimals: 1, omitExtraDecimalZeros: true })).toBe(
- '50.0%'
+ '50.0%',
);
expect(formatMeasure(50, 'PERCENT', { decimals: 3, omitExtraDecimalZeros: true })).toBe(
- '50.0%'
+ '50.0%',
);
expect(formatMeasure(50.89, 'PERCENT', { decimals: 3, omitExtraDecimalZeros: true })).toBe(
- '50.89%'
+ '50.89%',
);
});
diff --git a/server/sonar-web/src/main/js/helpers/__tests__/new-code-definition-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/new-code-definition-test.ts
index 7368b3c15a8..afd40743149 100644
--- a/server/sonar-web/src/main/js/helpers/__tests__/new-code-definition-test.ts
+++ b/server/sonar-web/src/main/js/helpers/__tests__/new-code-definition-test.ts
@@ -40,7 +40,7 @@ describe('isNewCodeDefinitionCompliant', () => {
'should test for new code definition compliance properly %s',
(newCodePeriod: NewCodeDefinition, result: boolean) => {
expect(isNewCodeDefinitionCompliant(newCodePeriod)).toEqual(result);
- }
+ },
);
});
@@ -74,11 +74,11 @@ describe('getNumberOfDaysDefaultValue', () => {
(
globalNewCodeDefinition: NewCodeDefinition | null,
inheritedNewCodeDefinition: NewCodeDefinition | null,
- result: string
+ result: string,
) => {
expect(
- getNumberOfDaysDefaultValue(globalNewCodeDefinition, inheritedNewCodeDefinition)
+ getNumberOfDaysDefaultValue(globalNewCodeDefinition, inheritedNewCodeDefinition),
).toEqual(result);
- }
+ },
);
});
diff --git a/server/sonar-web/src/main/js/helpers/__tests__/new-code-period-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/new-code-period-test.ts
index 52011866a7d..62fb5510824 100644
--- a/server/sonar-web/src/main/js/helpers/__tests__/new-code-period-test.ts
+++ b/server/sonar-web/src/main/js/helpers/__tests__/new-code-period-test.ts
@@ -34,20 +34,20 @@ describe('getPeriodLabel', () => {
it('should handle date', () => {
expect(getNewCodePeriodLabel(mockPeriod({ mode: 'date' }), formatter)).toBe(
- 'overview.period.date.'
+ 'overview.period.date.',
);
expect(
getNewCodePeriodLabel(
mockPeriod({ mode: 'date', parameter: '2019-02-21T01:11:21+0100' }),
- formatter
- )
+ formatter,
+ ),
).toBe('overview.period.date.2019-02-21T01:11:21+0100');
expect(formatter).toHaveBeenCalledTimes(1);
});
it('should handle days', () => {
expect(getNewCodePeriodLabel(mockPeriod({ mode: 'days', modeParam: '12' }), formatter)).toBe(
- 'overview.period.days.12'
+ 'overview.period.days.12',
);
expect(formatter).not.toHaveBeenCalled();
});
@@ -56,28 +56,28 @@ describe('getPeriodLabel', () => {
expect(
getNewCodePeriodLabel(
mockPeriod({ mode: 'previous_analysis', parameter: 'param' }),
- formatter
- )
+ formatter,
+ ),
).toBe('overview.period.previous_analysis.param');
expect(formatter).not.toHaveBeenCalled();
});
it('should handle previous version', () => {
expect(getNewCodePeriodLabel(mockPeriod({ mode: 'previous_version' }), formatter)).toBe(
- 'overview.period.previous_version_only_date'
+ 'overview.period.previous_version_only_date',
);
expect(
- getNewCodePeriodLabel(mockPeriod({ mode: 'previous_version', parameter: '7.9' }), formatter)
+ getNewCodePeriodLabel(mockPeriod({ mode: 'previous_version', parameter: '7.9' }), formatter),
).toBe('overview.period.previous_version.7.9');
expect(formatter).not.toHaveBeenCalled();
});
it('should handle version', () => {
expect(
- getNewCodePeriodLabel(mockPeriod({ mode: 'version', modeParam: '7.2' }), formatter)
+ getNewCodePeriodLabel(mockPeriod({ mode: 'version', modeParam: '7.2' }), formatter),
).toBe('overview.period.version.7.2');
expect(
- getNewCodePeriodLabel(mockPeriod({ mode: 'previous_version', parameter: '7.9' }), formatter)
+ getNewCodePeriodLabel(mockPeriod({ mode: 'previous_version', parameter: '7.9' }), formatter),
).toBe('overview.period.previous_version.7.9');
expect(formatter).not.toHaveBeenCalled();
});
@@ -86,11 +86,11 @@ describe('getPeriodLabel', () => {
expect(
getNewCodePeriodLabel(
mockPeriod({ mode: 'manual_baseline', modeParam: 'A658678DE' }),
- formatter
- )
+ formatter,
+ ),
).toBe('overview.period.manual_baseline.A658678DE');
expect(getNewCodePeriodLabel(mockPeriod({ mode: 'manual_baseline' }), formatter)).toBe(
- 'overview.period.manual_baseline.2019-04-23T02:12:32+0100'
+ 'overview.period.manual_baseline.2019-04-23T02:12:32+0100',
);
expect(formatter).toHaveBeenCalledTimes(1);
});
@@ -99,11 +99,14 @@ describe('getPeriodLabel', () => {
expect(
getNewCodePeriodLabel(
mockPeriod({ mode: NewCodeDefinitionType.SpecificAnalysis, parameter: '7.1' }),
- formatter
- )
+ formatter,
+ ),
).toBe('overview.period.specific_analysis.2019-04-23T02:12:32+0100');
expect(
- getNewCodePeriodLabel(mockPeriod({ mode: NewCodeDefinitionType.SpecificAnalysis }), formatter)
+ getNewCodePeriodLabel(
+ mockPeriod({ mode: NewCodeDefinitionType.SpecificAnalysis }),
+ formatter,
+ ),
).toBe('overview.period.specific_analysis.2019-04-23T02:12:32+0100');
expect(formatter).toHaveBeenCalledTimes(2);
});
@@ -112,11 +115,11 @@ describe('getPeriodLabel', () => {
expect(
getNewCodePeriodLabel(
mockPeriod({ mode: NewCodeDefinitionType.PreviousVersion, modeParam: 'A658678DE' }),
- formatter
- )
+ formatter,
+ ),
).toBe('overview.period.previous_version.A658678DE');
expect(
- getNewCodePeriodLabel(mockPeriod({ mode: NewCodeDefinitionType.PreviousVersion }), formatter)
+ getNewCodePeriodLabel(mockPeriod({ mode: NewCodeDefinitionType.PreviousVersion }), formatter),
).toBe('overview.period.previous_version.2019-04-23T02:12:32+0100');
expect(formatter).toHaveBeenCalledTimes(1);
});
diff --git a/server/sonar-web/src/main/js/helpers/__tests__/path-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/path-test.ts
index 9ffeddd415a..f89c8029f5f 100644
--- a/server/sonar-web/src/main/js/helpers/__tests__/path-test.ts
+++ b/server/sonar-web/src/main/js/helpers/__tests__/path-test.ts
@@ -41,13 +41,13 @@ describe('#collapsedDirFromPath()', () => {
it('should cut long path', () => {
expect(collapsedDirFromPath('src/main/js/components/navigator/app/models/state.js')).toBe(
- 'src/.../js/components/navigator/app/models/'
+ 'src/.../js/components/navigator/app/models/',
);
});
it('should cut very long path', () => {
expect(
- collapsedDirFromPath('src/main/another/js/components/navigator/app/models/state.js')
+ collapsedDirFromPath('src/main/another/js/components/navigator/app/models/state.js'),
).toBe('src/.../js/components/navigator/app/models/');
});
});
@@ -77,7 +77,7 @@ describe('#fileFromPath()', () => {
describe('#cutLongWords', () => {
it('should cut the long work in the middle', () => {
expect(cutLongWords('This is a reallylongwordthatdontexistforthe test')).toBe(
- 'This is a reallylongwordthatdontexistfor... test'
+ 'This is a reallylongwordthatdontexistfor... test',
);
});
diff --git a/server/sonar-web/src/main/js/helpers/__tests__/projects-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/projects-test.ts
index 6c73785fa77..93fa41ad0fb 100644
--- a/server/sonar-web/src/main/js/helpers/__tests__/projects-test.ts
+++ b/server/sonar-web/src/main/js/helpers/__tests__/projects-test.ts
@@ -29,7 +29,7 @@ describe('validateProjectKey', () => {
expect(validateProjectKey('123')).toBe(ProjectKeyValidationResult.OnlyDigits);
// Cannot be more than 400 chars long.
expect(validateProjectKey(new Array(PROJECT_KEY_MAX_LEN + 1).fill('a').join(''))).toBe(
- ProjectKeyValidationResult.TooLong
+ ProjectKeyValidationResult.TooLong,
);
// Cannot be empty.
expect(validateProjectKey('')).toBe(ProjectKeyValidationResult.Empty);
diff --git a/server/sonar-web/src/main/js/helpers/__tests__/qualityGates-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/qualityGates-test.ts
index 1b63083c946..b9bff4a5641 100644
--- a/server/sonar-web/src/main/js/helpers/__tests__/qualityGates-test.ts
+++ b/server/sonar-web/src/main/js/helpers/__tests__/qualityGates-test.ts
@@ -45,8 +45,8 @@ describe('extractStatusConditionsFromApplicationStatusChildProject', () => {
it('should correclty extract the conditions for the application child project status', () => {
expect(
extractStatusConditionsFromApplicationStatusChildProject(
- mockQualityGateApplicationStatus().projects[0]
- )
+ mockQualityGateApplicationStatus().projects[0],
+ ),
).toEqual([
{
actual: '10',
diff --git a/server/sonar-web/src/main/js/helpers/__tests__/request-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/request-test.ts
index ea446cb9d22..d2bf1d8c9a9 100644
--- a/server/sonar-web/src/main/js/helpers/__tests__/request-test.ts
+++ b/server/sonar-web/src/main/js/helpers/__tests__/request-test.ts
@@ -61,7 +61,7 @@ describe('getJSON', () => {
getJSON(url, { data: 'test' });
expect(window.fetch).toHaveBeenCalledWith(
url + '?data=test',
- expect.objectContaining({ method: 'GET' })
+ expect.objectContaining({ method: 'GET' }),
);
});
});
@@ -81,7 +81,7 @@ describe('getText', () => {
getText(url, { data: 'test' });
expect(window.fetch).toHaveBeenCalledWith(
url + '?data=test',
- expect.objectContaining({ method: 'GET' })
+ expect.objectContaining({ method: 'GET' }),
);
});
});
@@ -97,7 +97,7 @@ describe('parseError', () => {
it('should parse error and return concatenated messages', async () => {
const response = new Response(
JSON.stringify({ errors: [{ msg: 'Error1' }, { msg: 'Error2' }] }),
- { status: HttpStatus.BadRequest }
+ { status: HttpStatus.BadRequest },
);
await expect(parseError(response)).resolves.toBe('Error1. Error2');
});
@@ -145,7 +145,7 @@ describe('postJSON', () => {
postJSON(url, { data: 'test' });
expect(window.fetch).toHaveBeenCalledWith(
url,
- expect.objectContaining({ body: 'data=test', method: 'POST' })
+ expect.objectContaining({ body: 'data=test', method: 'POST' }),
);
});
});
@@ -169,7 +169,7 @@ describe('postJSONBody', () => {
headers: { Accept: 'application/json', 'Content-Type': 'application/json' },
body: '{"nested":{"data":"test","withArray":[1,2]}}',
method: 'POST',
- })
+ }),
);
});
});
@@ -183,7 +183,7 @@ describe('post', () => {
expect(window.fetch).toHaveBeenCalledWith(
url,
- expect.objectContaining({ body: 'data=test', method: 'POST' })
+ expect.objectContaining({ body: 'data=test', method: 'POST' }),
);
expect(response.json).not.toHaveBeenCalled();
expect(response.text).not.toHaveBeenCalled();
@@ -197,7 +197,7 @@ describe('post', () => {
expect(window.fetch).toHaveBeenCalledWith(
url,
- expect.objectContaining({ body: 'dataArray=1&dataArray=2', method: 'POST' })
+ expect.objectContaining({ body: 'dataArray=1&dataArray=2', method: 'POST' }),
);
});
});
@@ -220,7 +220,7 @@ describe('requestTryAndRepeatUntil', () => {
const promiseResult = requestTryAndRepeatUntil(
apiCall,
{ max: -1, slowThreshold: -20 },
- stopRepeat
+ stopRepeat,
);
for (let i = 1; i < 5; i++) {
@@ -245,7 +245,7 @@ describe('requestTryAndRepeatUntil', () => {
apiCall,
{ max: -1, slowThreshold: -20 },
stopRepeat,
- [HttpStatus.GatewayTimeout]
+ [HttpStatus.GatewayTimeout],
);
for (let i = 1; i < 5; i++) {
@@ -268,7 +268,7 @@ describe('requestTryAndRepeatUntil', () => {
const promiseResult = requestTryAndRepeatUntil(
apiCall,
{ max: 3, slowThreshold: 0 },
- stopRepeat
+ stopRepeat,
);
for (let i = 1; i < 3; i++) {
@@ -290,7 +290,7 @@ describe('requestTryAndRepeatUntil', () => {
const promiseResult = requestTryAndRepeatUntil(
apiCall,
{ max: 5, slowThreshold: 3 },
- stopRepeat
+ stopRepeat,
);
for (let i = 1; i < 3; i++) {
diff --git a/server/sonar-web/src/main/js/helpers/__tests__/sanitize-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/sanitize-test.ts
index de90bc2512e..8ea1e4da43c 100644
--- a/server/sonar-web/src/main/js/helpers/__tests__/sanitize-test.ts
+++ b/server/sonar-web/src/main/js/helpers/__tests__/sanitize-test.ts
@@ -31,7 +31,7 @@ describe('sanitizeStringRestricted', () => {
as well. This is <b>Amazing</b> and this <strong>bold</strong> <br>
and <code>code.is.accepted too</code>
</p>
- `)
+ `),
).toBe(`
Hi <a target="_blank" href="http://example.com">this</a> is <i>in italics</i> and <ul>
<li> lists </li>
@@ -125,7 +125,7 @@ describe('sanitizeStringRestricted', () => {
<span title=malformed attribs' do=don't id=foo checked onclick="a<b">Bar</span>`);
expect(clean.replace(/\s+/g, '')).toBe(
- `Clickyalert("&lt;b&gt;hi&lt;/b&gt;");&lt;divid=notarealtagonclick=notcode()&gt;&lt;notatag&lt;&lt;&lt;allinonetextblock&gt;&gt;&gt;&lt;%#somephpcodeherewrite("$horriblySyntacticConstruct1");%&gt;*/alert('hi');*/alert('hi');--&gt;*/alert('hi');--&gt;'}--&gt;--&gt;&lt;!--Zoicks--&gt;sectioninHTML]]&gt;<ahref=""></a><ahref="/">Bar</a>`
+ `Clickyalert("&lt;b&gt;hi&lt;/b&gt;");&lt;divid=notarealtagonclick=notcode()&gt;&lt;notatag&lt;&lt;&lt;allinonetextblock&gt;&gt;&gt;&lt;%#somephpcodeherewrite("$horriblySyntacticConstruct1");%&gt;*/alert('hi');*/alert('hi');--&gt;*/alert('hi');--&gt;'}--&gt;--&gt;&lt;!--Zoicks--&gt;sectioninHTML]]&gt;<ahref=""></a><ahref="/">Bar</a>`,
);
});
});
diff --git a/server/sonar-web/src/main/js/helpers/__tests__/security-standard-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/security-standard-test.ts
index 09bd047a51f..b6a284f1d8a 100644
--- a/server/sonar-web/src/main/js/helpers/__tests__/security-standard-test.ts
+++ b/server/sonar-web/src/main/js/helpers/__tests__/security-standard-test.ts
@@ -47,7 +47,7 @@ describe('renderCWECategory', () => {
};
it('should render cwe categories correctly', () => {
expect(renderCWECategory(standards, '1004')).toEqual(
- "CWE-1004 - Sensitive Cookie Without 'HttpOnly' Flag"
+ "CWE-1004 - Sensitive Cookie Without 'HttpOnly' Flag",
);
expect(renderCWECategory(standards, '124')).toEqual('CWE-124');
expect(renderCWECategory(standards, 'unknown')).toEqual('No CWE associated');
@@ -114,7 +114,7 @@ describe('renderPciDss32Category', () => {
};
it('should render Pci Dss 3.2 correctly', () => {
expect(renderPciDss32Category(standards, '1')).toEqual(
- '1 - Install and maintain a firewall configuration to protect cardholder data'
+ '1 - Install and maintain a firewall configuration to protect cardholder data',
);
expect(renderPciDss32Category(standards, '1.1')).toEqual('1.1');
});
@@ -136,7 +136,7 @@ describe('renderPciDss40Category', () => {
};
it('should render Pci Dss 4.0 correctly', () => {
expect(renderPciDss40Category(standards, '1')).toEqual(
- '1 - Install and maintain a firewall configuration to protect cardholder data'
+ '1 - Install and maintain a firewall configuration to protect cardholder data',
);
expect(renderPciDss40Category(standards, '1.1')).toEqual('1.1');
});
@@ -185,10 +185,10 @@ describe('renderSonarSourceSecurityCategory', () => {
};
it('should render sonarsource categories correctly', () => {
expect(renderSonarSourceSecurityCategory(standards, 'xss')).toEqual(
- 'Cross-Site Scripting (XSS)'
+ 'Cross-Site Scripting (XSS)',
);
expect(renderSonarSourceSecurityCategory(standards, 'xss', true)).toEqual(
- 'SONAR Cross-Site Scripting (XSS)'
+ 'SONAR Cross-Site Scripting (XSS)',
);
expect(renderSonarSourceSecurityCategory(standards, 'others')).toEqual('Others');
expect(renderSonarSourceSecurityCategory(standards, 'others', true)).toEqual('Others');
diff --git a/server/sonar-web/src/main/js/helpers/__tests__/stringify-queryparams-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/stringify-queryparams-test.ts
index f0b722f9ef1..4d015fe89a6 100644
--- a/server/sonar-web/src/main/js/helpers/__tests__/stringify-queryparams-test.ts
+++ b/server/sonar-web/src/main/js/helpers/__tests__/stringify-queryparams-test.ts
@@ -31,7 +31,7 @@ describe('stringify', () => {
};
expect(stringify(obj)).toEqual(
- 'prop1=a%20string&prop2=123&prop3=true&prop4=&prop5=9&prop5=8&prop5=7&prop6='
+ 'prop1=a%20string&prop2=123&prop3=true&prop4=&prop5=9&prop5=8&prop5=7&prop6=',
);
});
diff --git a/server/sonar-web/src/main/js/helpers/__tests__/strings-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/strings-test.ts
index f974915cb56..9920338721c 100644
--- a/server/sonar-web/src/main/js/helpers/__tests__/strings-test.ts
+++ b/server/sonar-web/src/main/js/helpers/__tests__/strings-test.ts
@@ -30,13 +30,13 @@ describe('#decodeJwt', () => {
};
expect(
decodeJwt(
- 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJhcmk6Y2xvdWQ6Yml0YnVja2V0OjphcHAvezMyNzcxM2VkLWYxYjItNDY1OS05YzkxLWM4ZWNmOGJlN2YzZX0vc29uYXJjbG91ZC1ncmVnIiwiaWF0IjoxNTQxMDU4NjA1LCJxc2giOiJhNmM5M2FkZGQ5NzFjMDVkMDhkYTFlMTY2OWMyNjQwZmJhNTI5ZTk4ZmJiNWIyYjllZmZhZGYwMGJmNDg0Mjc3IiwiYXVkIjoiYXJpOmNsb3VkOmJpdGJ1Y2tldDo6YXBwL3szMjc3MTNlZC1mMWIyLTQ2NTktOWM5MS1jOGVjZjhiZTdmM2V9L3NvbmFyY2xvdWQtZ3JlZyIsImV4cCI6MTU0MTA2MjIwNX0.5_0dFh_TPT_UorDewu2JEErgQE2ZnzBjvCDrOThseRo'
- )
+ 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJhcmk6Y2xvdWQ6Yml0YnVja2V0OjphcHAvezMyNzcxM2VkLWYxYjItNDY1OS05YzkxLWM4ZWNmOGJlN2YzZX0vc29uYXJjbG91ZC1ncmVnIiwiaWF0IjoxNTQxMDU4NjA1LCJxc2giOiJhNmM5M2FkZGQ5NzFjMDVkMDhkYTFlMTY2OWMyNjQwZmJhNTI5ZTk4ZmJiNWIyYjllZmZhZGYwMGJmNDg0Mjc3IiwiYXVkIjoiYXJpOmNsb3VkOmJpdGJ1Y2tldDo6YXBwL3szMjc3MTNlZC1mMWIyLTQ2NTktOWM5MS1jOGVjZjhiZTdmM2V9L3NvbmFyY2xvdWQtZ3JlZyIsImV4cCI6MTU0MTA2MjIwNX0.5_0dFh_TPT_UorDewu2JEErgQE2ZnzBjvCDrOThseRo',
+ ),
).toEqual(claims);
expect(
decodeJwt(
- 'eyJpc3MiOiJhcmk6Y2xvdWQ6Yml0YnVja2V0OjphcHAvezMyNzcxM2VkLWYxYjItNDY1OS05YzkxLWM4ZWNmOGJlN2YzZX0vc29uYXJjbG91ZC1ncmVnIiwiaWF0IjoxNTQxMDU4NjA1LCJxc2giOiJhNmM5M2FkZGQ5NzFjMDVkMDhkYTFlMTY2OWMyNjQwZmJhNTI5ZTk4ZmJiNWIyYjllZmZhZGYwMGJmNDg0Mjc3IiwiYXVkIjoiYXJpOmNsb3VkOmJpdGJ1Y2tldDo6YXBwL3szMjc3MTNlZC1mMWIyLTQ2NTktOWM5MS1jOGVjZjhiZTdmM2V9L3NvbmFyY2xvdWQtZ3JlZyIsImV4cCI6MTU0MTA2MjIwNX0'
- )
+ 'eyJpc3MiOiJhcmk6Y2xvdWQ6Yml0YnVja2V0OjphcHAvezMyNzcxM2VkLWYxYjItNDY1OS05YzkxLWM4ZWNmOGJlN2YzZX0vc29uYXJjbG91ZC1ncmVnIiwiaWF0IjoxNTQxMDU4NjA1LCJxc2giOiJhNmM5M2FkZGQ5NzFjMDVkMDhkYTFlMTY2OWMyNjQwZmJhNTI5ZTk4ZmJiNWIyYjllZmZhZGYwMGJmNDg0Mjc3IiwiYXVkIjoiYXJpOmNsb3VkOmJpdGJ1Y2tldDo6YXBwL3szMjc3MTNlZC1mMWIyLTQ2NTktOWM5MS1jOGVjZjhiZTdmM2V9L3NvbmFyY2xvdWQtZ3JlZyIsImV4cCI6MTU0MTA2MjIwNX0',
+ ),
).toEqual(claims);
});
});
@@ -44,7 +44,7 @@ describe('#decodeJwt', () => {
describe('#latinize', () => {
it('should remove diacritics and replace them with normal letters', () => {
expect(latinize('âêîôûŵŷäëïöüẅÿàèìòùẁỳáéíóúẃýøāēīūčģķļņšž')).toBe(
- 'aeiouwyaeiouwyaeiouwyaeiouwyoaeiucgklnsz'
+ 'aeiouwyaeiouwyaeiouwyaeiouwyoaeiucgklnsz',
);
expect(latinize('ASDFGhjklQWERTz')).toBe('ASDFGhjklQWERTz');
});
diff --git a/server/sonar-web/src/main/js/helpers/__tests__/tokens-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/tokens-test.ts
index b18ec26c225..cab23e1ce0b 100644
--- a/server/sonar-web/src/main/js/helpers/__tests__/tokens-test.ts
+++ b/server/sonar-web/src/main/js/helpers/__tests__/tokens-test.ts
@@ -65,8 +65,8 @@ describe('getAvailableExpirationOptions', () => {
value,
label: `users.tokens.expiration.${value.toString()}`,
};
- }
- )
+ },
+ ),
);
});
@@ -80,7 +80,7 @@ describe('getAvailableExpirationOptions', () => {
value,
label: `users.tokens.expiration.${value.toString()}`,
};
- })
+ }),
);
});
diff --git a/server/sonar-web/src/main/js/helpers/__tests__/urls-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/urls-test.ts
index f02f99ccd66..6e19414632b 100644
--- a/server/sonar-web/src/main/js/helpers/__tests__/urls-test.ts
+++ b/server/sonar-web/src/main/js/helpers/__tests__/urls-test.ts
@@ -58,7 +58,7 @@ describe('#convertGithubApiUrlToLink', () => {
it('should correctly convert a GitHub API URL to a Web URL', () => {
expect(convertGithubApiUrlToLink('https://api.github.com')).toBe('https://github.com');
expect(convertGithubApiUrlToLink('https://company.github.com/api/v3')).toBe(
- 'https://company.github.com'
+ 'https://company.github.com',
);
});
});
@@ -97,7 +97,7 @@ describe('#getComponentIssuesUrl', () => {
expect.objectContaining({
pathname: '/project/issues',
search: queryToSearch({ id: SIMPLE_COMPONENT_KEY }),
- })
+ }),
);
});
@@ -106,7 +106,7 @@ describe('#getComponentIssuesUrl', () => {
expect.objectContaining({
pathname: '/project/issues',
search: queryToSearch({ resolved: 'false', id: SIMPLE_COMPONENT_KEY }),
- })
+ }),
);
});
});
@@ -117,7 +117,7 @@ describe('#getComponentSecurityHotspotsUrl', () => {
expect.objectContaining({
pathname: '/security_hotspots',
search: queryToSearch({ id: SIMPLE_COMPONENT_KEY }),
- })
+ }),
);
});
@@ -132,7 +132,7 @@ describe('#getComponentSecurityHotspotsUrl', () => {
[SecurityStandard.PCI_DSS_3_2]: '4.2',
[SecurityStandard.PCI_DSS_4_0]: '4.1',
ignoredParam: '1234',
- })
+ }),
).toEqual(
expect.objectContaining({
pathname: '/security_hotspots',
@@ -146,7 +146,7 @@ describe('#getComponentSecurityHotspotsUrl', () => {
[SecurityStandard.PCI_DSS_3_2]: '4.2',
[SecurityStandard.PCI_DSS_4_0]: '4.1',
}),
- })
+ }),
);
});
});
@@ -157,7 +157,7 @@ describe('#getComponentOverviewUrl', () => {
expect.objectContaining({
pathname: '/portfolio',
search: queryToSearch({ id: SIMPLE_COMPONENT_KEY }),
- })
+ }),
);
});
it('should return a portfolio url for a subportfolio', () => {
@@ -165,7 +165,7 @@ describe('#getComponentOverviewUrl', () => {
expect.objectContaining({
pathname: '/portfolio',
search: queryToSearch({ id: SIMPLE_COMPONENT_KEY }),
- })
+ }),
);
});
it('should return a dashboard url for a project', () => {
@@ -173,7 +173,7 @@ describe('#getComponentOverviewUrl', () => {
expect.objectContaining({
pathname: '/dashboard',
search: queryToSearch({ id: SIMPLE_COMPONENT_KEY }),
- })
+ }),
);
});
it('should return correct dashboard url for a project when navigating from new code', () => {
@@ -182,13 +182,13 @@ describe('#getComponentOverviewUrl', () => {
SIMPLE_COMPONENT_KEY,
ComponentQualifier.Project,
undefined,
- CodeScope.New
- )
+ CodeScope.New,
+ ),
).toEqual(
expect.objectContaining({
pathname: '/dashboard',
search: queryToSearch({ id: SIMPLE_COMPONENT_KEY, code_scope: 'new' }),
- })
+ }),
);
});
it('should return correct dashboard url for a project when navigating from overall code', () => {
@@ -197,13 +197,13 @@ describe('#getComponentOverviewUrl', () => {
SIMPLE_COMPONENT_KEY,
ComponentQualifier.Project,
undefined,
- CodeScope.Overall
- )
+ CodeScope.Overall,
+ ),
).toEqual(
expect.objectContaining({
pathname: '/dashboard',
search: queryToSearch({ id: SIMPLE_COMPONENT_KEY, code_scope: 'overall' }),
- })
+ }),
);
});
it('should return a dashboard url for an app', () => {
@@ -211,7 +211,7 @@ describe('#getComponentOverviewUrl', () => {
expect.objectContaining({
pathname: '/dashboard',
search: queryToSearch({ id: SIMPLE_COMPONENT_KEY }),
- })
+ }),
);
});
});
@@ -219,34 +219,34 @@ describe('#getComponentOverviewUrl', () => {
describe('#getComponentDrilldownUrl', () => {
it('should return component drilldown url', () => {
expect(
- getComponentDrilldownUrl({ componentKey: SIMPLE_COMPONENT_KEY, metric: METRIC })
+ getComponentDrilldownUrl({ componentKey: SIMPLE_COMPONENT_KEY, metric: METRIC }),
).toEqual(
expect.objectContaining({
pathname: '/component_measures',
search: queryToSearch({ id: SIMPLE_COMPONENT_KEY, metric: METRIC }),
- })
+ }),
);
});
it('should not encode component key', () => {
expect(
- getComponentDrilldownUrl({ componentKey: COMPLEX_COMPONENT_KEY, metric: METRIC })
+ getComponentDrilldownUrl({ componentKey: COMPLEX_COMPONENT_KEY, metric: METRIC }),
).toEqual(
expect.objectContaining({
pathname: '/component_measures',
search: queryToSearch({ id: COMPLEX_COMPONENT_KEY, metric: METRIC }),
- })
+ }),
);
});
it('should add asc param only when its list view', () => {
expect(
- getComponentDrilldownUrl({ componentKey: SIMPLE_COMPONENT_KEY, metric: METRIC, asc: false })
+ getComponentDrilldownUrl({ componentKey: SIMPLE_COMPONENT_KEY, metric: METRIC, asc: false }),
).toEqual(
expect.objectContaining({
pathname: '/component_measures',
search: queryToSearch({ id: SIMPLE_COMPONENT_KEY, metric: METRIC }),
- })
+ }),
);
expect(
@@ -255,7 +255,7 @@ describe('#getComponentDrilldownUrl', () => {
metric: METRIC,
listView: true,
asc: false,
- })
+ }),
).toEqual(
expect.objectContaining({
pathname: '/component_measures',
@@ -265,7 +265,7 @@ describe('#getComponentDrilldownUrl', () => {
view: 'list',
asc: 'false',
}),
- })
+ }),
);
});
});
@@ -273,7 +273,7 @@ describe('#getComponentDrilldownUrl', () => {
describe('#getComponentDrilldownUrlWithSelection', () => {
it('should return component drilldown url with selection', () => {
expect(
- getComponentDrilldownUrlWithSelection(SIMPLE_COMPONENT_KEY, COMPLEX_COMPONENT_KEY, METRIC)
+ getComponentDrilldownUrlWithSelection(SIMPLE_COMPONENT_KEY, COMPLEX_COMPONENT_KEY, METRIC),
).toEqual(
expect.objectContaining({
pathname: '/component_measures',
@@ -282,7 +282,7 @@ describe('#getComponentDrilldownUrlWithSelection', () => {
metric: METRIC,
selected: COMPLEX_COMPONENT_KEY,
}),
- })
+ }),
);
});
@@ -292,8 +292,8 @@ describe('#getComponentDrilldownUrlWithSelection', () => {
SIMPLE_COMPONENT_KEY,
COMPLEX_COMPONENT_KEY,
METRIC,
- mockBranch({ name: 'foo' })
- )
+ mockBranch({ name: 'foo' }),
+ ),
).toEqual(
expect.objectContaining({
pathname: '/component_measures',
@@ -303,7 +303,7 @@ describe('#getComponentDrilldownUrlWithSelection', () => {
branch: 'foo',
selected: COMPLEX_COMPONENT_KEY,
}),
- })
+ }),
);
});
@@ -314,8 +314,8 @@ describe('#getComponentDrilldownUrlWithSelection', () => {
COMPLEX_COMPONENT_KEY,
METRIC,
undefined,
- MeasurePageView.list
- )
+ MeasurePageView.list,
+ ),
).toEqual(
expect.objectContaining({
pathname: '/component_measures',
@@ -325,7 +325,7 @@ describe('#getComponentDrilldownUrlWithSelection', () => {
view: MeasurePageView.list,
selected: COMPLEX_COMPONENT_KEY,
}),
- })
+ }),
);
expect(
@@ -334,8 +334,8 @@ describe('#getComponentDrilldownUrlWithSelection', () => {
COMPLEX_COMPONENT_KEY,
METRIC,
mockMainBranch(),
- MeasurePageView.treemap
- )
+ MeasurePageView.treemap,
+ ),
).toEqual(
expect.objectContaining({
pathname: '/component_measures',
@@ -345,7 +345,7 @@ describe('#getComponentDrilldownUrlWithSelection', () => {
view: MeasurePageView.treemap,
selected: COMPLEX_COMPONENT_KEY,
}),
- })
+ }),
);
expect(
@@ -354,8 +354,8 @@ describe('#getComponentDrilldownUrlWithSelection', () => {
COMPLEX_COMPONENT_KEY,
METRIC,
mockPullRequest({ key: '1' }),
- MeasurePageView.tree
- )
+ MeasurePageView.tree,
+ ),
).toEqual(
expect.objectContaining({
pathname: '/component_measures',
@@ -365,7 +365,7 @@ describe('#getComponentDrilldownUrlWithSelection', () => {
pullRequest: '1',
selected: COMPLEX_COMPONENT_KEY,
}),
- })
+ }),
);
});
});
@@ -434,7 +434,7 @@ describe('#getPathUrlAsString', () => {
getPathUrlAsString({
pathname: '/dashboard',
search: queryToSearch({ id: SIMPLE_COMPONENT_KEY }),
- })
+ }),
).toBe('/dashboard?id=' + SIMPLE_COMPONENT_KEY);
});
@@ -443,7 +443,7 @@ describe('#getPathUrlAsString', () => {
getPathUrlAsString({
pathname: '/dashboard',
search: queryToSearch({ id: COMPLEX_COMPONENT_KEY }),
- })
+ }),
).toBe('/dashboard?id=' + COMPLEX_COMPONENT_KEY_ENCODED);
});
@@ -510,7 +510,7 @@ describe('queryToSearch', () => {
};
expect(queryToSearch(query)).toBe(
- '?b1=true&b2=false&normalString=hello&author=GRRM&author=JKR&author=Stross'
+ '?b1=true&b2=false&normalString=hello&author=GRRM&author=JKR&author=Stross',
);
});
diff --git a/server/sonar-web/src/main/js/helpers/__tests__/users-test.ts b/server/sonar-web/src/main/js/helpers/__tests__/users-test.ts
index db3483a25e4..6be4278504e 100644
--- a/server/sonar-web/src/main/js/helpers/__tests__/users-test.ts
+++ b/server/sonar-web/src/main/js/helpers/__tests__/users-test.ts
@@ -32,8 +32,8 @@ describe('isSameHomePage', () => {
type: 'APPLICATION',
branch: 'test-branch',
component: 'test-component',
- }
- )
+ },
+ ),
).toBe(true);
expect(
@@ -45,8 +45,8 @@ describe('isSameHomePage', () => {
},
{
type: 'ISSUES',
- }
- )
+ },
+ ),
).toBe(false);
expect(
@@ -60,8 +60,8 @@ describe('isSameHomePage', () => {
type: 'APPLICATION',
branch: 'test-branch-1',
component: 'test-component',
- }
- )
+ },
+ ),
).toBe(false);
expect(
@@ -75,8 +75,8 @@ describe('isSameHomePage', () => {
type: 'APPLICATION',
branch: 'test-branch',
component: 'test-component-1',
- }
- )
+ },
+ ),
).toBe(false);
});
});