Skip to content

Commit

Permalink
fixed unit tests
Browse files Browse the repository at this point in the history
Signed-off-by: Amardeepsingh Siglani <amardeep7194@gmail.com>
  • Loading branch information
amsiglan committed Oct 23, 2024
1 parent efa785f commit d437eee
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const mockProps = () => ({
query: { query: '', language: 'kuery' } as Query,
} as SavedQueryAttributes,
},
saveQuery: jest.fn()

Check failure on line 36 in src/plugins/data/public/ui/saved_query_management/saved_query_management_component.test.tsx

View workflow job for this annotation

GitHub Actions / Lint and validate

Insert `,`
});

describe('Saved query management component', () => {
Expand All @@ -42,25 +43,25 @@ describe('Saved query management component', () => {
expect(wrapper.exists()).toBe(true);
});

it('should call onSave when save button is clicked', () => {
it('should call onInitiateSave when save button is clicked', () => {
const props = mockProps();
const wrapper = shallowWithIntl(<SavedQueryManagementComponent {...props} />);
const saveButton = wrapper
.find('[data-test-subj="saved-query-management-save-changes-button"]')
.at(0);
saveButton.simulate('click');
expect(props.onSave).toHaveBeenCalled();
expect(props.onInitiateSave).toHaveBeenCalled();
expect(props.closeMenuPopover).toHaveBeenCalled();
});

it('should call onSaveAsNew when save as new button is clicked', () => {
it('should call onInitiateSaveAsNew when save as new button is clicked', () => {
const props = mockProps();
const wrapper = shallowWithIntl(<SavedQueryManagementComponent {...props} />);
const saveAsNewButton = wrapper
.find('[data-test-subj="saved-query-management-save-as-new-button"]')
.at(0);
saveAsNewButton.simulate('click');
expect(props.onSaveAsNew).toHaveBeenCalled();
expect(props.onInitiateSaveAsNew).toHaveBeenCalled();
});

it('should call onClearSavedQuery when clear saved query button is clicked', () => {
Expand Down

0 comments on commit d437eee

Please sign in to comment.