chore: added a test that the selected types are rendered in the document
Signed-off-by: blam <ben@blam.sh>
This commit is contained in:
@@ -127,4 +127,26 @@ describe('CategoryPicker', () => {
|
||||
|
||||
expect(mockSetSelectedTypes).toHaveBeenCalledWith(['foo', 'bar']);
|
||||
});
|
||||
|
||||
it('should render the selectedTypes already in the document', async () => {
|
||||
const mockAvailableTypes = ['foo', 'bar'];
|
||||
const mockSelectedTypes = ['foo'];
|
||||
|
||||
(useEntityTypeFilter as jest.Mock).mockReturnValue({
|
||||
availableTypes: mockAvailableTypes,
|
||||
selectedTypes: mockSelectedTypes,
|
||||
});
|
||||
|
||||
const { getByRole } = await renderInTestApp(
|
||||
<TestApiProvider apis={[[alertApiRef, mockAlertApi]]}>
|
||||
<CategoryPicker />
|
||||
</TestApiProvider>,
|
||||
);
|
||||
|
||||
const openButton = getByRole('button', { name: 'Open' });
|
||||
await fireEvent(openButton, new MouseEvent('click', { bubbles: true }));
|
||||
|
||||
const fooCheckbox = getByRole('checkbox', { name: 'Foo' });
|
||||
expect(fooCheckbox).toBeChecked();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user