Fix tests

This commit is contained in:
Tim Hansen
2020-12-04 09:27:32 -07:00
parent e3071a0d49
commit b14cbe28d3
@@ -77,27 +77,23 @@ describe('<ProductEntityDialog/>', () => {
open
entity={atomicEntity}
onClose={jest.fn()}
selectedLabel={null}
setSelectedLabel={jest.fn()}
/>,
),
),
).toThrow();
});
it('Should not show tabs for a single sub-entity type', () => {
const { queryByText } = render(
it('Should show a tab for a single sub-entity type', () => {
const { getByText } = render(
wrapInTestApp(
<ProductEntityDialog
open
entity={singleBreakdownEntity}
onClose={jest.fn()}
selectedLabel={null}
setSelectedLabel={jest.fn()}
/>,
),
);
expect(queryByText('Breakdown by SKU')).not.toBeInTheDocument();
expect(getByText('Breakdown by SKU')).toBeInTheDocument();
});
it('Should show tabs when multiple sub-entity types exist', () => {
@@ -107,8 +103,6 @@ describe('<ProductEntityDialog/>', () => {
open
entity={multiBreakdownEntity}
onClose={jest.fn()}
selectedLabel={null}
setSelectedLabel={jest.fn()}
/>,
),
);
@@ -116,19 +110,4 @@ describe('<ProductEntityDialog/>', () => {
expect(getByText('Breakdown by deployment')).toBeInTheDocument();
expect(getByText('sku-1')).toBeInTheDocument();
});
it('Shows the pre-selected tab, if provided', () => {
const { getByText } = render(
wrapInTestApp(
<ProductEntityDialog
open
entity={multiBreakdownEntity}
onClose={jest.fn()}
selectedLabel="deployment"
setSelectedLabel={jest.fn()}
/>,
),
);
expect(getByText('d-1')).toBeInTheDocument();
});
});