diff options
author | Mike Greiling <mike@pixelcog.com> | 2018-10-17 10:13:26 +0300 |
---|---|---|
committer | Mike Greiling <mike@pixelcog.com> | 2018-10-17 19:18:17 +0300 |
commit | f666026d71ebefd70219d5078b1f0c83fa01f84d (patch) | |
tree | ce43feb99c12c21dd266d25de24b1768bac1d459 /spec/javascripts/integrations | |
parent | 5a6fffcffca3dc8e4f52c90d3d18eaefd9e48aef (diff) |
Prettify all spec files
Diffstat (limited to 'spec/javascripts/integrations')
-rw-r--r-- | spec/javascripts/integrations/integration_settings_form_spec.js | 73 |
1 files changed, 53 insertions, 20 deletions
diff --git a/spec/javascripts/integrations/integration_settings_form_spec.js b/spec/javascripts/integrations/integration_settings_form_spec.js index 3eaaee5cda6..9a1b2e6b7f4 100644 --- a/spec/javascripts/integrations/integration_settings_form_spec.js +++ b/spec/javascripts/integrations/integration_settings_form_spec.js @@ -69,7 +69,9 @@ describe('IntegrationSettingsForm', () => { integrationSettingsForm.toggleSubmitBtnLabel(true); - expect(integrationSettingsForm.$submitBtnLabel.text()).toEqual('Test settings and save changes'); + expect(integrationSettingsForm.$submitBtnLabel.text()).toEqual( + 'Test settings and save changes', + ); }); it('should set Save button label to "Save changes" when either serviceActive or canTestService (or both) is `false`', () => { @@ -131,8 +133,9 @@ describe('IntegrationSettingsForm', () => { mock.restore(); }); - it('should make an ajax request with provided `formData`', (done) => { - integrationSettingsForm.testSettings(formData) + it('should make an ajax request with provided `formData`', done => { + integrationSettingsForm + .testSettings(formData) .then(() => { expect(axios.put).toHaveBeenCalledWith(integrationSettingsForm.testEndPoint, formData); @@ -141,7 +144,7 @@ describe('IntegrationSettingsForm', () => { .catch(done.fail); }); - it('should show error Flash with `Save anyway` action if ajax request responds with error in test', (done) => { + it('should show error Flash with `Save anyway` action if ajax request responds with error in test', done => { const errorMessage = 'Test failed.'; mock.onPut(integrationSettingsForm.testEndPoint).reply(200, { error: true, @@ -150,20 +153,31 @@ describe('IntegrationSettingsForm', () => { test_failed: true, }); - integrationSettingsForm.testSettings(formData) + integrationSettingsForm + .testSettings(formData) .then(() => { const $flashContainer = $('.flash-container'); - expect($flashContainer.find('.flash-text').text().trim()).toEqual('Test failed. some error'); + expect( + $flashContainer + .find('.flash-text') + .text() + .trim(), + ).toEqual('Test failed. some error'); expect($flashContainer.find('.flash-action')).toBeDefined(); - expect($flashContainer.find('.flash-action').text().trim()).toEqual('Save anyway'); + expect( + $flashContainer + .find('.flash-action') + .text() + .trim(), + ).toEqual('Save anyway'); done(); }) .catch(done.fail); }); - it('should not show error Flash with `Save anyway` action if ajax request responds with error in validation', (done) => { + it('should not show error Flash with `Save anyway` action if ajax request responds with error in validation', done => { const errorMessage = 'Validations failed.'; mock.onPut(integrationSettingsForm.testEndPoint).reply(200, { error: true, @@ -172,27 +186,39 @@ describe('IntegrationSettingsForm', () => { test_failed: false, }); - integrationSettingsForm.testSettings(formData) + integrationSettingsForm + .testSettings(formData) .then(() => { const $flashContainer = $('.flash-container'); - expect($flashContainer.find('.flash-text').text().trim()).toEqual('Validations failed. some error'); + expect( + $flashContainer + .find('.flash-text') + .text() + .trim(), + ).toEqual('Validations failed. some error'); expect($flashContainer.find('.flash-action')).toBeDefined(); - expect($flashContainer.find('.flash-action').text().trim()).toEqual(''); + expect( + $flashContainer + .find('.flash-action') + .text() + .trim(), + ).toEqual(''); done(); }) .catch(done.fail); }); - it('should submit form if ajax request responds without any error in test', (done) => { + it('should submit form if ajax request responds without any error in test', done => { spyOn(integrationSettingsForm.$form, 'submit'); mock.onPut(integrationSettingsForm.testEndPoint).reply(200, { error: false, }); - integrationSettingsForm.testSettings(formData) + integrationSettingsForm + .testSettings(formData) .then(() => { expect(integrationSettingsForm.$form.submit).toHaveBeenCalled(); @@ -201,7 +227,7 @@ describe('IntegrationSettingsForm', () => { .catch(done.fail); }); - it('should submit form when clicked on `Save anyway` action of error Flash', (done) => { + it('should submit form when clicked on `Save anyway` action of error Flash', done => { spyOn(integrationSettingsForm.$form, 'submit'); const errorMessage = 'Test failed.'; @@ -211,7 +237,8 @@ describe('IntegrationSettingsForm', () => { test_failed: true, }); - integrationSettingsForm.testSettings(formData) + integrationSettingsForm + .testSettings(formData) .then(() => { const $flashAction = $('.flash-container .flash-action'); @@ -227,26 +254,32 @@ describe('IntegrationSettingsForm', () => { .catch(done.fail); }); - it('should show error Flash if ajax request failed', (done) => { + it('should show error Flash if ajax request failed', done => { const errorMessage = 'Something went wrong on our end.'; mock.onPut(integrationSettingsForm.testEndPoint).networkError(); - integrationSettingsForm.testSettings(formData) + integrationSettingsForm + .testSettings(formData) .then(() => { - expect($('.flash-container .flash-text').text().trim()).toEqual(errorMessage); + expect( + $('.flash-container .flash-text') + .text() + .trim(), + ).toEqual(errorMessage); done(); }) .catch(done.fail); }); - it('should always call `toggleSubmitBtnState` with `false` once request is completed', (done) => { + it('should always call `toggleSubmitBtnState` with `false` once request is completed', done => { mock.onPut(integrationSettingsForm.testEndPoint).networkError(); spyOn(integrationSettingsForm, 'toggleSubmitBtnState'); - integrationSettingsForm.testSettings(formData) + integrationSettingsForm + .testSettings(formData) .then(() => { expect(integrationSettingsForm.toggleSubmitBtnState).toHaveBeenCalledWith(false); |