Skip to content

Commit

Permalink
Fix Refresh Interval Modal tests
Browse files Browse the repository at this point in the history
  • Loading branch information
agatapst committed Jan 11, 2021
1 parent 16094f1 commit 1338b16
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/
import React from 'react';
import { mount, shallow } from 'enzyme';
import { mount } from 'enzyme';

import ModalTrigger from 'src/components/ModalTrigger';
import RefreshIntervalModal from 'src/dashboard/components/RefreshIntervalModal';
Expand Down Expand Up @@ -66,11 +66,15 @@ describe('RefreshIntervalModal', () => {
refreshWarning: 'Show warning',
};

const wrapper = shallow(<RefreshIntervalModal {...props} />);
const wrapper = getMountWrapper(props);
wrapper.find('span[role="button"]').simulate('click');

wrapper.instance().handleFrequencyChange({ value: 30 });
expect(wrapper.find(ModalTrigger).dive().find(Alert)).toExist();
wrapper.update();
expect(wrapper.find(ModalTrigger).find(Alert)).toExist();

wrapper.instance().handleFrequencyChange({ value: 3601 });
expect(wrapper.find(ModalTrigger).dive().find(Alert)).not.toExist();
wrapper.update();
expect(wrapper.find(ModalTrigger).find(Alert)).not.toExist();
});
});

0 comments on commit 1338b16

Please sign in to comment.