Skip to content
Snippets Groups Projects
Commit 75e11922 authored by Clement Ho's avatar Clement Ho
Browse files

Merge branch 'fix-external-dashboard-specs' into 'master'

Fix "operation settings external dashboard component" Jest specs

See merge request gitlab-org/gitlab-ce!29160
parents e794649b 0e403386
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -114,6 +114,8 @@ describe('operation settings external dashboard component', () => {
});
 
describe('submit button', () => {
const findSubmitButton = () => wrapper.find('.settings-content form').find(GlButton);
const endpointRequest = [
operationsSettingsEndpoint,
{
Loading
Loading
@@ -127,14 +129,14 @@ describe('operation settings external dashboard component', () => {
 
it('renders button label', () => {
mountComponent();
const submit = wrapper.find(GlButton);
const submit = findSubmitButton();
expect(submit.text()).toBe('Save Changes');
});
 
it('submits form on click', () => {
mountComponent(false);
axios.patch.mockResolvedValue();
wrapper.find(GlButton).trigger('click');
findSubmitButton().trigger('click');
 
expect(axios.patch).toHaveBeenCalledWith(...endpointRequest);
 
Loading
Loading
@@ -145,7 +147,7 @@ describe('operation settings external dashboard component', () => {
mountComponent(false);
const message = 'mockErrorMessage';
axios.patch.mockRejectedValue({ response: { data: { message } } });
wrapper.find(GlButton).trigger('click');
findSubmitButton().trigger('click');
 
expect(axios.patch).toHaveBeenCalledWith(...endpointRequest);
 
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment