Commit 3ca43788 authored by Alexander Turinske's avatar Alexander Turinske

Fix missing styling

- break out string into two strings
- update tests
parent eb978c52
......@@ -12,28 +12,48 @@ export default {
required: true,
},
},
computed: {
shouldShowCountMessage() {
return !this.message.status && Boolean(this.message.countMessage);
},
},
methods: {
getSeverityClass(severity) {
return SEVERITY_CLASS_NAME_MAP[severity];
},
},
slotNames: ['critical', 'high', 'other'],
spacingClasses: {
critical: 'gl-pl-4',
high: 'gl-px-2',
other: 'gl-px-2',
},
};
</script>
<template>
<span>
<gl-sprintf :message="message.message">
<template #count="{content}">
<template #total="{content}">
<strong>{{ content }}</strong>
</template>
<template v-for="slotName in ['critical', 'high', 'other']" #[slotName]="{content}">
<span :key="slotName">
<strong v-if="Boolean(message[slotName])" :class="getSeverityClass(slotName)">
{{ content }}
</strong>
<span v-else>{{ content }}</span>
</span>
</template>
</gl-sprintf>
<span v-if="shouldShowCountMessage" class="gl-font-sm">
<gl-sprintf :message="message.countMessage">
<template v-for="slotName in $options.slotNames" #[slotName]="{content}">
<span :key="slotName">
<strong
v-if="message[slotName] > 0"
:class="[getSeverityClass(slotName), $options.spacingClasses[slotName]]"
>
{{ content }}
</strong>
<span v-else :class="$options.spacingClasses[slotName]">
{{ content }}
</span>
</span>
</template>
</gl-sprintf>
</span>
</span>
</template>
......@@ -555,7 +555,6 @@ export default {
<template v-if="hasCoverageFuzzingReports">
<summary-row
:summary="groupedCoverageFuzzingText.message"
:status-icon="coverageFuzzingStatusIcon"
:popover-options="coverageFuzzingPopover"
class="js-coverage-fuzzing-widget"
......
......@@ -9,6 +9,29 @@ import { __, n__, sprintf } from '~/locale';
export const findIssueIndex = (issues, issue) =>
issues.findIndex(el => el.project_fingerprint === issue.project_fingerprint);
const createCountMessage = ({ critical, high, other, total }) => {
const otherMessage = n__('%d Other', '%d Others', other);
const countMessage = __(
'%{criticalStart}%{critical} Critical%{criticalEnd} %{highStart}%{high} High%{highEnd} and %{otherStart}%{otherMessage}%{otherEnd}',
);
return total ? sprintf(countMessage, { critical, high, otherMessage }) : '';
};
const createStatusMessage = ({ reportType, status, total }) => {
const vulnMessage = n__('vulnerability', 'vulnerabilities', total);
let message;
if (status) {
message = __('%{reportType} %{status}');
} else if (!total) {
message = __('%{reportType} detected %{totalStart}no%{totalEnd} vulnerabilities.');
} else {
message = __(
'%{reportType} detected %{totalStart}%{total}%{totalEnd} potential %{vulnMessage}',
);
}
return sprintf(message, { reportType, status, total, vulnMessage });
};
/**
* Takes an object of options and returns the object with an externalized string representing
* the critical, high, and other severity vulnerabilities for a given report.
......@@ -27,35 +50,15 @@ export const groupedTextBuilder = ({
other = 0,
} = {}) => {
const total = critical + high + other;
const vulnMessage = n__('vulnerability', 'vulnerabilities', total);
const otherMessage = n__('%d Other', '%d Others', other);
let message;
if (status) {
message = __('%{reportType} %{status}');
} else if (!total) {
message = __('%{reportType} detected %{countStart}no%{countEnd} vulnerabilities.');
} else {
message = __(
'%{reportType} detected %{countStart}%{total}%{countEnd} potential %{vulnMessage} %{criticalStart}%{critical} critical%{criticalEnd} %{highStart}%{high} high%{highEnd} and %{otherStart}%{otherMessage}%{otherEnd}',
);
}
return {
message: sprintf(message, {
critical,
high,
otherMessage,
reportType,
status,
total,
vulnMessage,
}).replace(/\s\s+/g, ' '),
countMessage: createCountMessage({ critical, high, other, total }),
message: createStatusMessage({ reportType, status, total }),
critical,
high,
other,
status,
total,
};
};
......
......@@ -140,7 +140,7 @@ describe('ee merge request widget options', () => {
`${SAST_SELECTOR} .report-block-list-issue-description`,
).textContent,
),
).toEqual('SAST detected 1 potential vulnerability 1 critical 0 high and 0 Others');
).toEqual('SAST detected 1 potential vulnerability 1 Critical 0 High and 0 Others');
done();
});
});
......@@ -235,8 +235,8 @@ describe('ee merge request widget options', () => {
`${DEPENDENCY_SCANNING_SELECTOR} .report-block-list-issue-description`,
).textContent,
),
).toContain(
'Dependency scanning detected 2 potential vulnerabilities 1 critical 1 high and 0 Others',
).toEqual(
'Dependency scanning detected 2 potential vulnerabilities 1 Critical 1 High and 0 Others',
);
done();
});
......@@ -663,7 +663,7 @@ describe('ee merge request widget options', () => {
).textContent,
),
).toEqual(
'Container scanning detected 2 potential vulnerabilities 1 critical 1 high and 0 Others',
'Container scanning detected 2 potential vulnerabilities 1 Critical 1 High and 0 Others',
);
done();
});
......@@ -734,10 +734,12 @@ describe('ee merge request widget options', () => {
it('should render provided data', done => {
setImmediate(() => {
expect(
findExtendedSecurityWidget()
.querySelector(`${DAST_SELECTOR} .report-block-list-issue-description`)
.textContent.trim(),
).toContain('DAST detected 1 potential vulnerability');
trimText(
findExtendedSecurityWidget().querySelector(
`${DAST_SELECTOR} .report-block-list-issue-description`,
).textContent,
),
).toEqual('DAST detected 1 potential vulnerability 1 Critical 0 High and 0 Others');
done();
});
});
......@@ -810,10 +812,14 @@ describe('ee merge request widget options', () => {
it('should render provided data', done => {
setImmediate(() => {
expect(
findExtendedSecurityWidget()
.querySelector(`${COVERAGE_FUZZING_SELECTOR} .report-block-list-issue-description`)
.textContent.trim(),
).toContain('Coverage fuzzing detected 2 potential vulnerabilities');
trimText(
findExtendedSecurityWidget().querySelector(
`${COVERAGE_FUZZING_SELECTOR} .report-block-list-issue-description`,
).textContent,
),
).toEqual(
'Coverage fuzzing detected 2 potential vulnerabilities 1 Critical 1 High and 0 Others',
);
done();
});
});
......@@ -889,7 +895,7 @@ describe('ee merge request widget options', () => {
).textContent,
),
).toEqual(
'Secret scanning detected 2 potential vulnerabilities 1 critical 1 high and 0 Others',
'Secret scanning detected 2 potential vulnerabilities 1 Critical 1 High and 0 Others',
);
done();
});
......
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Severity Summary given the message {"critical": 0, "high": 1, "message": "Security scanning detected %{countStart}1%{countEnd} potential vulnerability %{criticalStart}0 critical%{criticalEnd} %{highStart}1 high%{highEnd} and %{otherStart}0 Others%{otherEnd}", "other": 0, "status": ""} interpolates correctly 1`] = `
exports[`Severity Summary given the message {"countMessage": "%{criticalStart}0 Critical%{criticalEnd} %{highStart}1 High%{highEnd} and %{otherStart}0 Others%{otherEnd}", "critical": 0, "high": 1, "message": "Security scanning detected %{totalStart}1%{totalEnd} potential vulnerability", "other": 0, "status": "", "total": 1} interpolates correctly 1`] = `
<span>
Security scanning detected
<strong>
1
</strong>
potential vulnerability
<span>
<span
class="gl-font-sm"
>
<span>
0 critical
<span
class="gl-pl-4"
>
0 Critical
</span>
</span>
</span>
<span>
<strong
class="text-danger-600"
>
1 high
<span>
<strong
class="text-danger-600 gl-px-2"
>
</strong>
</span>
and
<span>
1 High
</strong>
</span>
and
<span>
0 Others
<span
class="gl-px-2"
>
0 Others
</span>
</span>
</span>
</span>
`;
exports[`Severity Summary given the message {"critical": 1, "high": 0, "message": "Security scanning detected %{countStart}1%{countEnd} potential vulnerability %{criticalStart}1 critical%{criticalEnd} %{highStart}0 high%{highEnd} and %{otherStart}0 Others%{otherEnd}", "other": 0, "status": ""} interpolates correctly 1`] = `
exports[`Severity Summary given the message {"countMessage": "%{criticalStart}1 Critical%{criticalEnd} %{highStart}0 High%{highEnd} and %{otherStart}0 Others%{otherEnd}", "critical": 1, "high": 0, "message": "Security scanning detected %{totalStart}1%{totalEnd} potential vulnerability", "other": 0, "status": "", "total": 1} interpolates correctly 1`] = `
<span>
Security scanning detected
<strong>
1
</strong>
potential vulnerability
<span>
<strong
class="text-danger-800"
>
1 critical
<span
class="gl-font-sm"
>
<span>
<strong
class="text-danger-800 gl-pl-4"
>
</strong>
</span>
<span>
1 Critical
</strong>
</span>
<span>
0 high
<span
class="gl-px-2"
>
0 High
</span>
</span>
</span>
and
<span>
and
<span>
0 Others
<span
class="gl-px-2"
>
0 Others
</span>
</span>
</span>
</span>
`;
exports[`Severity Summary given the message {"critical": 1, "high": 2, "message": "Security scanning detected %{countStart}3%{countEnd} potential vulnerabilities %{criticalStart}1 critical%{criticalEnd} %{highStart}2 high%{highEnd} and %{otherStart}0 Others%{otherEnd}", "other": 0, "status": ""} interpolates correctly 1`] = `
exports[`Severity Summary given the message {"countMessage": "%{criticalStart}1 Critical%{criticalEnd} %{highStart}2 High%{highEnd} and %{otherStart}0 Others%{otherEnd}", "critical": 1, "high": 2, "message": "Security scanning detected %{totalStart}3%{totalEnd} potential vulnerabilities", "other": 0, "status": "", "total": 3} interpolates correctly 1`] = `
<span>
Security scanning detected
<strong>
3
</strong>
potential vulnerabilities
<span>
<strong
class="text-danger-800"
>
1 critical
<span
class="gl-font-sm"
>
<span>
<strong
class="text-danger-800 gl-pl-4"
>
</strong>
</span>
<span>
<strong
class="text-danger-600"
>
2 high
1 Critical
</strong>
</span>
<span>
<strong
class="text-danger-600 gl-px-2"
>
</strong>
</span>
and
<span>
2 High
</strong>
</span>
and
<span>
0 Others
<span
class="gl-px-2"
>
0 Others
</span>
</span>
</span>
</span>
`;
exports[`Severity Summary given the message {"message": ""} interpolates correctly 1`] = `<span />`;
exports[`Severity Summary given the message {"message": ""} interpolates correctly 1`] = `
<span>
<!---->
</span>
`;
exports[`Severity Summary given the message {"message": "foo"} interpolates correctly 1`] = `
<span>
foo
foo
<!---->
</span>
`;
......@@ -144,9 +144,11 @@ describe('Grouped security reports app', () => {
it('renders error state', () => {
expect(wrapper.vm.$el.querySelector('.gl-spinner')).toBeNull();
expect(wrapper.vm.$el.querySelector('.js-code-text').textContent.trim()).toEqual(
'Security scanning failed loading any results',
);
expect(
wrapper.vm.$el
.querySelector('[data-testid="report-section-code-text"]')
.textContent.trim(),
).toEqual('Security scanning failed loading any results');
expect(wrapper.vm.$el.querySelector('.js-collapse-btn').textContent.trim()).toEqual(
'Expand',
......@@ -185,9 +187,11 @@ describe('Grouped security reports app', () => {
it('renders loading summary text + spinner', () => {
expect(wrapper.vm.$el.querySelector('.gl-spinner')).not.toBeNull();
expect(wrapper.vm.$el.querySelector('.js-code-text').textContent.trim()).toEqual(
'Security scanning is loading',
);
expect(
wrapper.vm.$el
.querySelector('[data-testid="report-section-code-text"]')
.textContent.trim(),
).toEqual('Security scanning is loading');
expect(wrapper.vm.$el.querySelector('.js-collapse-btn').textContent.trim()).toEqual(
'Expand',
......@@ -228,9 +232,11 @@ describe('Grouped security reports app', () => {
expect(wrapper.vm.$el.querySelector('.gl-spinner')).toBeNull();
// Renders the summary text
expect(wrapper.vm.$el.querySelector('.js-code-text').textContent.trim()).toEqual(
'Security scanning detected no vulnerabilities.',
);
expect(
wrapper.vm.$el
.querySelector('[data-testid="report-section-code-text"]')
.textContent.trim(),
).toEqual('Security scanning detected no vulnerabilities.');
// Renders Sast result
expect(trimText(wrapper.vm.$el.textContent)).toContain('SAST detected no vulnerabilities.');
......@@ -276,8 +282,12 @@ describe('Grouped security reports app', () => {
expect(wrapper.vm.$el.querySelector('.gl-spinner')).toBeNull();
// Renders the summary text
expect(wrapper.vm.$el.querySelector('.js-code-text').textContent.trim()).toContain(
'Security scanning detected 10 potential vulnerabilities',
expect(
trimText(
wrapper.vm.$el.querySelector('[data-testid="report-section-code-text"]').textContent,
),
).toEqual(
'Security scanning detected 10 potential vulnerabilities 6 Critical 4 High and 0 Others',
);
// Renders the expand button
......@@ -287,25 +297,27 @@ describe('Grouped security reports app', () => {
// Renders Sast result
expect(trimText(wrapper.vm.$el.textContent)).toContain(
'SAST detected 1 potential vulnerability',
'SAST detected 1 potential vulnerability 1 Critical 0 High and 0 Others',
);
// Renders DSS result
expect(trimText(wrapper.vm.$el.textContent)).toContain(
'Dependency scanning detected 2 potential vulnerabilities',
'Dependency scanning detected 2 potential vulnerabilities 1 Critical 1 High and 0 Others',
);
// Renders container scanning result
expect(wrapper.vm.$el.textContent).toContain(
'Container scanning detected 2 potential vulnerabilities',
expect(trimText(wrapper.vm.$el.textContent)).toContain(
'Container scanning detected 2 potential vulnerabilities 1 Critical 1 High and 0 Others',
);
// Renders DAST result
expect(wrapper.vm.$el.textContent).toContain('DAST detected 1 potential vulnerability');
expect(trimText(wrapper.vm.$el.textContent)).toContain(
'DAST detected 1 potential vulnerability 1 Critical 0 High and 0 Others',
);
// Renders container scanning result
expect(wrapper.vm.$el.textContent).toContain(
'Coverage fuzzing detected 2 potential vulnerabilities',
expect(trimText(wrapper.vm.$el.textContent)).toContain(
'Coverage fuzzing detected 2 potential vulnerabilities 1 Critical 1 High and 0 Others',
);
});
......@@ -426,7 +438,9 @@ describe('Grouped security reports app', () => {
});
it('should display the correct numbers of vulnerabilities', () => {
expect(wrapper.text()).toContain('Container scanning detected 2 potential vulnerabilities');
expect(trimText(wrapper.text())).toContain(
'Container scanning detected 2 potential vulnerabilities 1 Critical 1 High and 0 Others',
);
});
});
......@@ -454,8 +468,8 @@ describe('Grouped security reports app', () => {
});
it('should display the correct numbers of vulnerabilities', () => {
expect(wrapper.vm.$el.textContent).toContain(
'Dependency scanning detected 2 potential vulnerabilities',
expect(trimText(wrapper.vm.$el.textContent)).toContain(
'Dependency scanning detected 2 potential vulnerabilities 1 Critical 1 High and 0 Others',
);
});
});
......@@ -485,7 +499,9 @@ describe('Grouped security reports app', () => {
});
it('should display the correct numbers of vulnerabilities', () => {
expect(wrapper.vm.$el.textContent).toContain('DAST detected 1 potential vulnerability');
expect(trimText(wrapper.vm.$el.textContent)).toContain(
'DAST detected 1 potential vulnerability 1 Critical 0 High and 0 Others',
);
});
it('shows the scanned URLs count and opens a modal', async () => {
......@@ -565,7 +581,9 @@ describe('Grouped security reports app', () => {
});
it('should display the correct numbers of vulnerabilities', () => {
expect(wrapper.text()).toContain('Secret scanning detected 2 potential vulnerabilities');
expect(trimText(wrapper.text())).toContain(
'Secret scanning detected 2 potential vulnerabilities 1 Critical 1 High and 0 Others',
);
});
});
......@@ -602,7 +620,9 @@ describe('Grouped security reports app', () => {
});
it('should display the correct numbers of vulnerabilities', () => {
expect(wrapper.vm.$el.textContent).toContain('SAST detected 1 potential vulnerability');
expect(trimText(wrapper.vm.$el.textContent)).toContain(
'SAST detected 1 potential vulnerability 1 Critical 0 High and 0 Others',
);
});
});
......
......@@ -30,11 +30,13 @@ describe('groupedSastText', () => {
const result = getters.groupedSastText(sast);
expect(result).toStrictEqual({
countMessage: '',
critical: 0,
high: 0,
message: 'SAST detected %{countStart}no%{countEnd} vulnerabilities.',
message: 'SAST detected %{totalStart}no%{totalEnd} vulnerabilities.',
other: 0,
status: '',
total: 0,
});
});
});
......
......@@ -116,32 +116,37 @@ describe('security reports utils', () => {
const other = 7;
it.each`
vulnerabilities | message
${undefined} | ${' detected %{countStart}no%{countEnd} vulnerabilities.'}
${{ critical }} | ${` detected %{countStart}2%{countEnd} potential vulnerabilities %{criticalStart}2 critical%{criticalEnd} %{highStart}0 high%{highEnd} and %{otherStart}0 Others%{otherEnd}`}
${{ high }} | ${` detected %{countStart}4%{countEnd} potential vulnerabilities %{criticalStart}0 critical%{criticalEnd} %{highStart}4 high%{highEnd} and %{otherStart}0 Others%{otherEnd}`}
${{ other }} | ${` detected %{countStart}7%{countEnd} potential vulnerabilities %{criticalStart}0 critical%{criticalEnd} %{highStart}0 high%{highEnd} and %{otherStart}7 Others%{otherEnd}`}
${{ critical, high }} | ${` detected %{countStart}6%{countEnd} potential vulnerabilities %{criticalStart}2 critical%{criticalEnd} %{highStart}4 high%{highEnd} and %{otherStart}0 Others%{otherEnd}`}
${{ critical, other }} | ${` detected %{countStart}9%{countEnd} potential vulnerabilities %{criticalStart}2 critical%{criticalEnd} %{highStart}0 high%{highEnd} and %{otherStart}7 Others%{otherEnd}`}
${{ high, other }} | ${` detected %{countStart}11%{countEnd} potential vulnerabilities %{criticalStart}0 critical%{criticalEnd} %{highStart}4 high%{highEnd} and %{otherStart}7 Others%{otherEnd}`}
${{ critical, high, other }} | ${` detected %{countStart}13%{countEnd} potential vulnerabilities %{criticalStart}2 critical%{criticalEnd} %{highStart}4 high%{highEnd} and %{otherStart}7 Others%{otherEnd}`}
`('should build the message as "$message"', ({ vulnerabilities, message }) => {
vulnerabilities | message | countMessage
${undefined} | ${' detected %{totalStart}no%{totalEnd} vulnerabilities.'} | ${''}
${{ critical }} | ${` detected %{totalStart}2%{totalEnd} potential vulnerabilities`} | ${`%{criticalStart}2 Critical%{criticalEnd} %{highStart}0 High%{highEnd} and %{otherStart}0 Others%{otherEnd}`}
${{ high }} | ${` detected %{totalStart}4%{totalEnd} potential vulnerabilities`} | ${`%{criticalStart}0 Critical%{criticalEnd} %{highStart}4 High%{highEnd} and %{otherStart}0 Others%{otherEnd}`}
${{ other }} | ${` detected %{totalStart}7%{totalEnd} potential vulnerabilities`} | ${`%{criticalStart}0 Critical%{criticalEnd} %{highStart}0 High%{highEnd} and %{otherStart}7 Others%{otherEnd}`}
${{ critical, high }} | ${` detected %{totalStart}6%{totalEnd} potential vulnerabilities`} | ${`%{criticalStart}2 Critical%{criticalEnd} %{highStart}4 High%{highEnd} and %{otherStart}0 Others%{otherEnd}`}
${{ critical, other }} | ${` detected %{totalStart}9%{totalEnd} potential vulnerabilities`} | ${`%{criticalStart}2 Critical%{criticalEnd} %{highStart}0 High%{highEnd} and %{otherStart}7 Others%{otherEnd}`}
${{ high, other }} | ${` detected %{totalStart}11%{totalEnd} potential vulnerabilities`} | ${`%{criticalStart}0 Critical%{criticalEnd} %{highStart}4 High%{highEnd} and %{otherStart}7 Others%{otherEnd}`}
${{ critical, high, other }} | ${` detected %{totalStart}13%{totalEnd} potential vulnerabilities`} | ${`%{criticalStart}2 Critical%{criticalEnd} %{highStart}4 High%{highEnd} and %{otherStart}7 Others%{otherEnd}`}
`('should build the message as "$message"', ({ vulnerabilities, message, countMessage }) => {
expect(groupedTextBuilder(vulnerabilities).message).toEqual(message);
expect(groupedTextBuilder(vulnerabilities).countMessage).toEqual(countMessage);
});
it.each`
vulnerabilities | message
${{ critical: 1 }} | ${` detected %{countStart}1%{countEnd} potential vulnerability %{criticalStart}1 critical%{criticalEnd} %{highStart}0 high%{highEnd} and %{otherStart}0 Others%{otherEnd}`}
${{ high: 1 }} | ${` detected %{countStart}1%{countEnd} potential vulnerability %{criticalStart}0 critical%{criticalEnd} %{highStart}1 high%{highEnd} and %{otherStart}0 Others%{otherEnd}`}
${{ other: 1 }} | ${` detected %{countStart}1%{countEnd} potential vulnerability %{criticalStart}0 critical%{criticalEnd} %{highStart}0 high%{highEnd} and %{otherStart}1 Other%{otherEnd}`}
`('should handle single vulnerabilities for "$message"', ({ vulnerabilities, message }) => {
expect(groupedTextBuilder(vulnerabilities).message).toEqual(message);
});
vulnerabilities | message | countMessage
${{ critical: 1 }} | ${` detected %{totalStart}1%{totalEnd} potential vulnerability`} | ${`%{criticalStart}1 Critical%{criticalEnd} %{highStart}0 High%{highEnd} and %{otherStart}0 Others%{otherEnd}`}
${{ high: 1 }} | ${` detected %{totalStart}1%{totalEnd} potential vulnerability`} | ${`%{criticalStart}0 Critical%{criticalEnd} %{highStart}1 High%{highEnd} and %{otherStart}0 Others%{otherEnd}`}
${{ other: 1 }} | ${` detected %{totalStart}1%{totalEnd} potential vulnerability`} | ${`%{criticalStart}0 Critical%{criticalEnd} %{highStart}0 High%{highEnd} and %{otherStart}1 Other%{otherEnd}`}
`(
'should handle single vulnerabilities for "$message"',
({ vulnerabilities, message, countMessage }) => {
expect(groupedTextBuilder(vulnerabilities).message).toEqual(message);
expect(groupedTextBuilder(vulnerabilities).countMessage).toEqual(countMessage);
},
);
it('should pass through the report type', () => {
const reportType = 'HAL';
expect(groupedTextBuilder({ reportType }).message).toEqual(
'HAL detected %{countStart}no%{countEnd} vulnerabilities.',
'HAL detected %{totalStart}no%{totalEnd} vulnerabilities.',
);
});
......@@ -149,11 +154,13 @@ describe('security reports utils', () => {
const reportType = 'HAL';
const status = 'is loading';
expect(groupedTextBuilder({ reportType, status })).toEqual({
countMessage: '',
critical: 0,
high: 0,
message: 'HAL is loading',
other: 0,
status: 'is loading',
total: 0,
});
});
});
......@@ -193,7 +200,7 @@ describe('security reports utils', () => {
${[{ severity: LOW }, { severity: MEDIUM }]} | ${{ critical: 0, high: 0, other: 2 }}
${[{ severity: CRITICAL }, { severity: HIGH }]} | ${{ critical: 1, high: 1, other: 0 }}
${[{ severity: CRITICAL }, { severity: LOW }]} | ${{ critical: 1, high: 0, other: 1 }}
`('should count the vulnerabilities correctly', ({ vulnerabilities, response }) => {
`('should total the vulnerabilities correctly', ({ vulnerabilities, response }) => {
expect(countVulnerabilities(vulnerabilities)).toEqual(response);
});
});
......@@ -223,11 +230,13 @@ describe('security reports utils', () => {
const result = groupedReportText(report, reportType, errorMessage, loadingMessage);
expect(result).toStrictEqual({
countMessage: '',
critical: 0,
high: 0,
message: 'dummyReport detected %{countStart}no%{countEnd} vulnerabilities.',
message: 'dummyReport detected %{totalStart}no%{totalEnd} vulnerabilities.',
other: 0,
status: '',
total: 0,
});
});
});
......
......@@ -450,6 +450,9 @@ msgstr ""
msgid "%{count} total weight"
msgstr ""
msgid "%{criticalStart}%{critical} Critical%{criticalEnd} %{highStart}%{high} High%{highEnd} and %{otherStart}%{otherMessage}%{otherEnd}"
msgstr ""
msgid "%{dashboard_path} could not be found."
msgstr ""
......@@ -718,10 +721,10 @@ msgstr ""
msgid "%{reportType} %{status}"
msgstr ""
msgid "%{reportType} detected %{countStart}%{total}%{countEnd} potential %{vulnMessage} %{criticalStart}%{critical} critical%{criticalEnd} %{highStart}%{high} high%{highEnd} and %{otherStart}%{otherMessage}%{otherEnd}"
msgid "%{reportType} detected %{totalStart}%{total}%{totalEnd} potential %{vulnMessage}"
msgstr ""
msgid "%{reportType} detected %{countStart}no%{countEnd} vulnerabilities."
msgid "%{reportType} detected %{totalStart}no%{totalEnd} vulnerabilities."
msgstr ""
msgid "%{retryButtonStart}Try again%{retryButtonEnd} or %{newFileButtonStart}attach a new file%{newFileButtonEnd}."
......
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