Skip to content

Commit

Permalink
fixing unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
cauemarcondes committed Nov 13, 2019
1 parent 7d92d0a commit e88e4a9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
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 && keyValuePairs.length > 0) {
if (!isEmpty(keyValuePairs)) {
return <KeyValueTable keyValuePairs={keyValuePairs} />;
}
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ import { expectTextsInDocument } from '../../../../utils/testHelpers';

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

0 comments on commit e88e4a9

Please sign in to comment.