-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding webview logic for non applicable vulnerabilities. (#63)
- Loading branch information
Showing
8 changed files
with
180 additions
and
30 deletions.
There are no files selected for viewing
17 changes: 0 additions & 17 deletions
17
src/components/Page/Dependency/ApplicabilityEvidence.module.css
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
src/components/UI/InformationTabs/ApplicabilityEvidence.module.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
.rowList { | ||
display: flex; | ||
flex-direction: column; | ||
gap: 16px; | ||
} | ||
.defaultContainer { | ||
display: flex; | ||
flex-direction: column; | ||
gap: 16px; | ||
} | ||
.subtitle { | ||
color: #f0f0f0; | ||
font-size: 12px; | ||
font-style: normal; | ||
font-weight: 600; | ||
line-height: normal; | ||
} | ||
|
||
ul.bulletList { | ||
list-style-type: disc; | ||
padding-left: 20px; | ||
} | ||
ul.bulletList li { | ||
color: white; | ||
font-family: 'Arial', sans-serif; | ||
margin-bottom: 10px; | ||
display: flex; | ||
align-items: center; | ||
} | ||
ul { | ||
list-style-type: disc; | ||
margin-left: 20px; | ||
} | ||
|
||
ol { | ||
list-style-type: decimal; | ||
margin-left: 20px; | ||
} | ||
li { | ||
margin-bottom: 20px; | ||
} |
80 changes: 80 additions & 0 deletions
80
src/components/UI/InformationTabs/ApplicabilityEvidence.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import { render, screen } from '@testing-library/react' | ||
import ApplicabilityEvidence from './ApplicabilityEvidence' | ||
import { IApplicableDetails, IEvidence } from '../../../model' | ||
|
||
// Sample data for testing | ||
const applicableData: IApplicableDetails = { | ||
isApplicable: true, | ||
searchTarget: 'Example search target', | ||
evidence: [ | ||
{ | ||
filePathEvidence: 'file/path/evidence', | ||
codeEvidence: 'const example = "example";', | ||
reason: 'Reason for applicability' | ||
} as IEvidence | ||
] | ||
} | ||
|
||
const notApplicableData: IApplicableDetails = { | ||
isApplicable: false, | ||
searchTarget: 'Example search target', | ||
evidence: [ | ||
{ | ||
reason: 'Reason for non-applicability' | ||
} as IEvidence | ||
] | ||
} | ||
|
||
describe('ApplicabilityEvidence component', () => { | ||
test('renders applicable CVE information correctly', () => { | ||
render(<ApplicabilityEvidence data={applicableData} />) | ||
expect(screen.getByText('Contextual Analysis')).toBeInTheDocument() | ||
expect(screen.getByText('Why is this CVE applicable?')).toBeInTheDocument() | ||
expect(screen.getByText('Reason for applicability')).toBeInTheDocument() | ||
expect(screen.getByText('file/path/evidence')).toBeInTheDocument() | ||
expect(screen.getByText('const example = "example";')).toBeInTheDocument() | ||
expect(screen.getByText('What does the scanner check/look for?')).toBeInTheDocument() | ||
expect(screen.getByText('Example search target')).toBeInTheDocument() | ||
}) | ||
|
||
test('renders non-applicable CVE information correctly', () => { | ||
render(<ApplicabilityEvidence data={notApplicableData} />) | ||
expect(screen.getByText('Contextual Analysis')).toBeInTheDocument() | ||
expect(screen.getByText('Why is this CVE not applicable?')).toBeInTheDocument() | ||
expect(screen.getByText('Reason for non-applicability')).toBeInTheDocument() | ||
expect(screen.getByText('What does the scanner check/look for?')).toBeInTheDocument() | ||
expect(screen.getByText('Example search target')).toBeInTheDocument() | ||
}) | ||
|
||
test('renders evidence section correctly when no evidence provided', () => { | ||
const noEvidenceData: IApplicableDetails = { | ||
isApplicable: true, | ||
searchTarget: 'Example search target', | ||
evidence: [] | ||
} | ||
render(<ApplicabilityEvidence data={noEvidenceData} />) | ||
expect(screen.getByText('Contextual Analysis')).toBeInTheDocument() | ||
expect(screen.getByText('Why is this CVE applicable?')).toBeInTheDocument() | ||
expect(screen.getByText('What does the scanner check/look for?')).toBeInTheDocument() | ||
expect(screen.getByText('Example search target')).toBeInTheDocument() | ||
}) | ||
|
||
test('renders correctly without searchTarget', () => { | ||
const noSearchTargetData: IApplicableDetails = { | ||
isApplicable: true, | ||
evidence: [ | ||
{ | ||
filePathEvidence: 'file/path/evidence', | ||
codeEvidence: 'const example = "example";', | ||
reason: 'Reason for applicability' | ||
} as IEvidence | ||
] | ||
} | ||
render(<ApplicabilityEvidence data={noSearchTargetData} />) | ||
expect(screen.getByText('Contextual Analysis')).toBeInTheDocument() | ||
expect(screen.getByText('Why is this CVE applicable?')).toBeInTheDocument() | ||
expect(screen.getByText('file/path/evidence')).toBeInTheDocument() | ||
expect(screen.getByText('const example = "example";')).toBeInTheDocument() | ||
expect(screen.queryByText('What does the scanner check/look for?')).not.toBeInTheDocument() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters