fix(export vuln): change sheet name and download options name (#417)

Signed-off-by: Andreea-Lupu <andreealupu1470@yahoo.com>
This commit is contained in:
Andreea Lupu 2024-01-18 15:41:18 +02:00 committed by GitHub
parent df19fa811c
commit 12f9229320
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 6 additions and 6 deletions

View File

@ -574,13 +574,13 @@ describe('Vulnerabilties page', () => {
fireEvent.click(downloadBtn[0]);
expect(await screen.findByTestId('export-csv-menuItem')).toBeInTheDocument();
expect(await screen.findByTestId('export-excel-menuItem')).toBeInTheDocument();
const exportAsCSVBtn = screen.getByText(/CSV/i);
const exportAsCSVBtn = screen.getByText(/csv/i);
expect(exportAsCSVBtn).toBeInTheDocument();
global.URL.createObjectURL = jest.fn();
await fireEvent.click(exportAsCSVBtn);
expect(await screen.findByTestId('export-csv-menuItem')).not.toBeInTheDocument();
fireEvent.click(downloadBtn[0]);
const exportAsExcelBtn = screen.getByText(/MS Excel/i);
const exportAsExcelBtn = screen.getByText(/xlsx/i);
expect(exportAsExcelBtn).toBeInTheDocument();
await fireEvent.click(exportAsExcelBtn);
expect(await screen.findByTestId('export-excel-menuItem')).not.toBeInTheDocument();

View File

@ -106,7 +106,7 @@ const useStyles = makeStyles((theme) => ({
overflow: 'hidden',
padding: '0.3rem',
display: 'flex',
justifyContent: 'center'
justifyContent: 'left'
}
}));
@ -195,7 +195,7 @@ function VulnerabilitiesDetails(props) {
const wb = XLSX.utils.book_new(),
ws = XLSX.utils.json_to_sheet(allCveData);
XLSX.utils.book_append_sheet(wb, ws, name + '_' + tag);
XLSX.utils.book_append_sheet(wb, ws, name.replaceAll('/', '_') + '_' + tag);
XLSX.writeFile(wb, `${name}:${tag}-vulnerabilities.xlsx`);
@ -350,7 +350,7 @@ function VulnerabilitiesDetails(props) {
className={classes.popper}
data-testid="export-csv-menuItem"
>
CSV
csv
</MenuItem>
<Divider sx={{ my: 0.5 }} />
<MenuItem
@ -360,7 +360,7 @@ function VulnerabilitiesDetails(props) {
className={classes.popper}
data-testid="export-excel-menuItem"
>
MS Excel
xlsx
</MenuItem>
</Menu>
</Stack>