test: Add jest-enzyme assertion library for better frontend tests (#10459)

* adding jest-enzyme

* enzymeify lots of assertions

* types for jest-enzyme
This commit is contained in:
David Aaron Suddjian
2020-07-29 10:53:06 -07:00
committed by GitHub
parent 671461d0d0
commit 7f70a241f9
111 changed files with 1074 additions and 315 deletions

View File

@@ -58,23 +58,23 @@ describe('Divider', () => {
it('should render a DragDroppable', () => {
const wrapper = setup();
expect(wrapper.find(DragDroppable)).toHaveLength(1);
expect(wrapper.find(DragDroppable)).toExist();
});
it('should render a div with class "dashboard-component-divider"', () => {
const wrapper = setup();
expect(wrapper.find('.dashboard-component-divider')).toHaveLength(1);
expect(wrapper.find('.dashboard-component-divider')).toExist();
});
it('should render a HoverMenu with DeleteComponentButton in editMode', () => {
let wrapper = setup();
expect(wrapper.find(HoverMenu)).toHaveLength(0);
expect(wrapper.find(DeleteComponentButton)).toHaveLength(0);
expect(wrapper.find(HoverMenu)).not.toExist();
expect(wrapper.find(DeleteComponentButton)).not.toExist();
// we cannot set props on the Divider because of the WithDragDropContext wrapper
wrapper = setup({ editMode: true });
expect(wrapper.find(HoverMenu)).toHaveLength(1);
expect(wrapper.find(DeleteComponentButton)).toHaveLength(1);
expect(wrapper.find(HoverMenu)).toExist();
expect(wrapper.find(DeleteComponentButton)).toExist();
});
it('should call deleteComponent when deleted', () => {