Skip to content

Commit

Permalink
fix(export vuln): change sheet name and download options name (#417)
Browse files Browse the repository at this point in the history
Signed-off-by: Andreea-Lupu <[email protected]>
  • Loading branch information
Andreea-Lupu authored Jan 18, 2024
1 parent df19fa8 commit 12f9229
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/__tests__/TagPage/VulnerabilitiesDetails.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
8 changes: 4 additions & 4 deletions src/components/Tag/Tabs/VulnerabilitiesDetails.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ const useStyles = makeStyles((theme) => ({
overflow: 'hidden',
padding: '0.3rem',
display: 'flex',
justifyContent: 'center'
justifyContent: 'left'
}
}));

Expand Down Expand Up @@ -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`);

Expand Down Expand Up @@ -350,7 +350,7 @@ function VulnerabilitiesDetails(props) {
className={classes.popper}
data-testid="export-csv-menuItem"
>
CSV
csv
</MenuItem>
<Divider sx={{ my: 0.5 }} />
<MenuItem
Expand All @@ -360,7 +360,7 @@ function VulnerabilitiesDetails(props) {
className={classes.popper}
data-testid="export-excel-menuItem"
>
MS Excel
xlsx
</MenuItem>
</Menu>
</Stack>
Expand Down

0 comments on commit 12f9229

Please sign in to comment.