mirror of
https://github.com/fleetdm/fleet
synced 2026-05-24 09:28:54 +00:00
Renders All Platform Icon if platform is null (#1243)
This commit is contained in:
parent
5be9d69165
commit
cfc390b179
2 changed files with 12 additions and 3 deletions
|
|
@ -4,7 +4,7 @@ import Checkbox from 'components/forms/fields/Checkbox';
|
|||
import ClickableTableRow from 'components/ClickableTableRow';
|
||||
import Icon from 'components/icons/Icon';
|
||||
import PlatformIcon from 'components/icons/PlatformIcon';
|
||||
import { isEqual } from 'lodash';
|
||||
import { isEmpty, isEqual } from 'lodash';
|
||||
import scheduledQueryInterface from 'interfaces/scheduled_query';
|
||||
|
||||
class ScheduledQueriesListItem extends Component {
|
||||
|
|
@ -52,9 +52,9 @@ class ScheduledQueriesListItem extends Component {
|
|||
|
||||
renderPlatformIcon = () => {
|
||||
const { scheduledQuery: { platform } } = this.props;
|
||||
const platformArr = platform.split(',');
|
||||
const platformArr = platform ? platform.split(',') : [];
|
||||
|
||||
if (platformArr.includes('all')) {
|
||||
if (isEmpty(platformArr) || platformArr.includes('all')) {
|
||||
return <PlatformIcon name="" />;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -24,6 +24,15 @@ describe('ScheduledQueriesListItem - component', () => {
|
|||
expect(component.find('PlatformIcon').length).toEqual(1);
|
||||
});
|
||||
|
||||
it('renders when the platform attribute is null', () => {
|
||||
const scheduledQuery = { ...scheduledQueryStub, platform: null };
|
||||
const component = mount(<ScheduledQueriesListItem checked={false} onSelect={noop} scheduledQuery={scheduledQuery} />);
|
||||
expect(component.text()).toInclude(scheduledQueryStub.name);
|
||||
expect(component.text()).toInclude(scheduledQueryStub.interval);
|
||||
expect(component.text()).toInclude(scheduledQueryStub.shard);
|
||||
expect(component.find('PlatformIcon').length).toEqual(1);
|
||||
});
|
||||
|
||||
it('renders a Checkbox component', () => {
|
||||
const component = mount(<ScheduledQueriesListItem {...defaultProps} />);
|
||||
expect(component.find('Checkbox').length).toEqual(1);
|
||||
|
|
|
|||
Loading…
Reference in a new issue