-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a column to show the status (unconfirmed, confirmed, false positi… (
#1081) Add a column to show the status (unconfirmed, confirmed, false positive, etc.) of security warnings, violations, etc. so that the user doesn't have to expand them to see the status. Closes #1070.
- Loading branch information
Showing
7 changed files
with
94 additions
and
21 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
import React from 'react'; | ||
import { mount } from 'enzyme'; | ||
import { SourceEntities } from './SourceEntities'; | ||
|
||
const data_model = { | ||
sources: { | ||
source_type: { | ||
entities: { | ||
metric_type: | ||
{ | ||
name: "entity name", | ||
attributes: [{key: "1"}, {key: "2"}] | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
const metric = { | ||
type: "metric_type", | ||
sources: { | ||
source_uuid: { | ||
type: "source_type" | ||
} | ||
} | ||
} | ||
|
||
const source = { | ||
source_uuid: "source_uuid", | ||
entities: [ | ||
{ | ||
key: "1" | ||
}, | ||
{ | ||
key: "2" | ||
} | ||
] | ||
} | ||
|
||
describe('<SourceEntities />', () => { | ||
it('renders', () => { | ||
const wrapper = mount(<SourceEntities datamodel={data_model} metric={metric} source={source} />); | ||
expect(wrapper.find("TableRow").at(1).hasClass("status_unknown")) | ||
}); | ||
it('sorts', () => { | ||
const wrapper = mount(<SourceEntities datamodel={data_model} metric={metric} source={source} />); | ||
wrapper.find("TableHeaderCell").at(1).simulate("click"); | ||
expect(wrapper.find("TableHeaderCell").at(1).prop("sorted")).toBe("ascending"); | ||
wrapper.find("TableHeaderCell").at(1).simulate("click"); | ||
expect(wrapper.find("TableHeaderCell").at(1).prop("sorted")).toBe("descending"); | ||
wrapper.find("TableHeaderCell").at(2).simulate("click"); | ||
expect(wrapper.find("TableHeaderCell").at(2).prop("sorted")).toBe("descending"); | ||
wrapper.find("TableHeaderCell").at(2).simulate("click"); | ||
expect(wrapper.find("TableHeaderCell").at(2).prop("sorted")).toBe("ascending"); | ||
}) | ||
}); |
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
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,7 @@ | ||
export const source_entity_status_name = { | ||
unconfirmed: "Unconfirmed", | ||
confirmed: "Confirmed", | ||
fixed: "Fixed", | ||
false_positive: "False positive", | ||
wont_fix: "Won't fix" | ||
} |
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