Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,18 @@
*/

import React from 'react';
import { isEmpty } from 'lodash';
import { i18n } from '@kbn/i18n';
import { EuiText } from '@elastic/eui';
import { KeyValueTable } from '../KeyValueTable';
import { KeyValuePair } from '../../../utils/flattenObject';

interface Props {
keyValuePairs?: KeyValuePair[];
keyValuePairs: KeyValuePair[];
}

export function Section({ keyValuePairs }: Props) {
if (keyValuePairs) {
if (!isEmpty(keyValuePairs)) {
return <KeyValueTable keyValuePairs={keyValuePairs} />;
}
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { expectTextsInDocument } from '../../../../utils/testHelpers';

describe('Section', () => {
it('shows "empty state message" if no data is available', () => {
const output = render(<Section />);
expectTextsInDocument(output, ['No data available']);
const component = render(<Section keyValuePairs={[]} />);
expectTextsInDocument(component, ['No data available']);
});
});