Skip to content

Commit

Permalink
few more cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
stephmilovic committed Jan 7, 2021
1 parent d725669 commit 18f1be5
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,29 +34,29 @@ describe('StatusFilter', () => {
it('should call onStatusChanged when changing status to open', async () => {
const wrapper = mount(<StatusFilter {...defaultProps} />);

wrapper.find('button[data-test-subj="case-status-filter"]').simulate('click');
wrapper.find('button[data-test-subj="case-status-filter-open"]').simulate('click');
await waitFor(() => {
wrapper.find('button[data-test-subj="case-status-filter"]').simulate('click');
wrapper.find('button[data-test-subj="case-status-filter-open"]').simulate('click');
expect(onStatusChanged).toBeCalledWith('open');
});
});

it('should call onStatusChanged when changing status to in-progress', async () => {
const wrapper = mount(<StatusFilter {...defaultProps} />);

wrapper.find('button[data-test-subj="case-status-filter"]').simulate('click');
wrapper.find('button[data-test-subj="case-status-filter-in-progress"]').simulate('click');
await waitFor(() => {
wrapper.find('button[data-test-subj="case-status-filter"]').simulate('click');
wrapper.find('button[data-test-subj="case-status-filter-in-progress"]').simulate('click');
expect(onStatusChanged).toBeCalledWith('in-progress');
});
});

it('should call onStatusChanged when changing status to closed', async () => {
const wrapper = mount(<StatusFilter {...defaultProps} />);

wrapper.find('button[data-test-subj="case-status-filter"]').simulate('click');
wrapper.find('button[data-test-subj="case-status-filter-closed"]').simulate('click');
await waitFor(() => {
wrapper.find('button[data-test-subj="case-status-filter"]').simulate('click');
wrapper.find('button[data-test-subj="case-status-filter-closed"]').simulate('click');
expect(onStatusChanged).toBeCalledWith('closed');
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,9 @@ describe('SyncAlertsToggle', () => {
</MockHookWrapperComponent>
);

await waitFor(() => {
expect(
wrapper.find(`[data-test-subj="caseSyncAlerts"] .euiSwitch__label`).first().text()
).toBe('On');
});
expect(wrapper.find(`[data-test-subj="caseSyncAlerts"] .euiSwitch__label`).first().text()).toBe(
'On'
);

wrapper.find('[data-test-subj="caseSyncAlerts"] button').first().simulate('click');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ describe('StatusActionButton', () => {
});

describe('Button icons', () => {
it('it renders the correct button icon: status open', async () => {
it('it renders the correct button icon: status open', () => {
const wrapper = mount(<StatusActionButton {...defaultProps} />);

expect(
wrapper.find(`[data-test-subj="case-view-status-action-button"]`).first().prop('iconType')
).toBe('folderExclamation');
});

it('it renders the correct button icon: status in-progress', async () => {
it('it renders the correct button icon: status in-progress', () => {
const wrapper = mount(
<StatusActionButton {...defaultProps} status={CaseStatuses['in-progress']} />
);
Expand All @@ -44,7 +44,7 @@ describe('StatusActionButton', () => {
).toBe('folderCheck');
});

it('it renders the correct button icon: status closed', async () => {
it('it renders the correct button icon: status closed', () => {
const wrapper = mount(<StatusActionButton {...defaultProps} status={CaseStatuses.closed} />);

expect(
Expand All @@ -54,7 +54,7 @@ describe('StatusActionButton', () => {
});

describe('Status rotation', () => {
it('rotates correctly to in-progress when status is open', async () => {
it('rotates correctly to in-progress when status is open', () => {
const wrapper = mount(<StatusActionButton {...defaultProps} />);

wrapper
Expand All @@ -64,7 +64,7 @@ describe('StatusActionButton', () => {
expect(onStatusChanged).toHaveBeenCalledWith('in-progress');
});

it('rotates correctly to closed when status is in-progress', async () => {
it('rotates correctly to closed when status is in-progress', () => {
const wrapper = mount(
<StatusActionButton {...defaultProps} status={CaseStatuses['in-progress']} />
);
Expand All @@ -76,7 +76,7 @@ describe('StatusActionButton', () => {
expect(onStatusChanged).toHaveBeenCalledWith('closed');
});

it('rotates correctly to open when status is closed', async () => {
it('rotates correctly to open when status is closed', () => {
const wrapper = mount(<StatusActionButton {...defaultProps} status={CaseStatuses.closed} />);

wrapper
Expand Down

0 comments on commit 18f1be5

Please sign in to comment.