Skip to content

Commit

Permalink
EOS - Add Rule ID (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
Or-Geva authored Aug 6, 2023
1 parent 04448d5 commit 655180d
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/components/Page/Eos/Eos.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ describe('Eos component', () => {
endRow: 1,
endColumn: 10
},
ruleId: 'ruleId-1',
description: 'Description example',
remediation: ['Remediation 1', 'Remediation 2'],
foundText: 'Found text example',
Expand All @@ -38,6 +39,7 @@ describe('Eos component', () => {
}
]
}

test('renders header', () => {
const { getByText } = render(<Eos data={mockData} />)
const headerElement = getByText('Header example')
Expand Down Expand Up @@ -65,6 +67,12 @@ describe('Eos component', () => {
expect(getByText('Description example')).toBeInTheDocument()
})

test('renders rule id', () => {
const { getByText } = render(<Eos data={mockData} />)
const severityElement = getByTextAcrossMultipleElements(getByText, 'Rule ID: ruleId-1')
expect(severityElement).toBeInTheDocument()
})

test('renders remediation 1', () => {
const { getByText } = render(<Eos data={mockData} />)
expect(getByText('DESCRIPTION')).toBeInTheDocument()
Expand Down
2 changes: 2 additions & 0 deletions src/components/Page/Eos/Eos.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import Research from './Research'
import ContextualAnalysis from './ContextualAnalysis'
import Severity from '../../UI/Summary/Severity'
import { IEosPage } from '../../../model/webviewPages'
import Row from '../../UI/Row/Row'

export interface Props {
data: IEosPage
Expand All @@ -25,6 +26,7 @@ export default function Eos(props: Props): JSX.Element {
<Vulnerability location={`${props.data.location.file}`} />
<Severity severity={props.data.severity ? props.data.severity : ISeverity.Unknown} />
<VulnerabilityLine line={`${props.data.location.startRow}`} />
{!!props.data.ruleId && <Row title="Rule ID" data={props.data.ruleId} />}
</Summary>
<Research description={props.data.description} remediation={props.data.remediation} />
<ContextualAnalysis
Expand Down
1 change: 0 additions & 1 deletion src/components/UI/Summary/Summary.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
}

.halfText {
max-height: 5em;
line-height: 22px;
overflow: hidden;
transition: max-height 1s ease-out;
Expand Down
1 change: 1 addition & 0 deletions src/model/webviewPages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export interface IEosPage {
foundText?: string
analysisStep?: IAnalysisStep[]
severity?: ISeverity
ruleId?: string
}

export interface IIaCPage {
Expand Down

0 comments on commit 655180d

Please sign in to comment.