Commit dc3de71f authored by kushalpandya's avatar kushalpandya Committed by Jarka Kadlecova

Update tests based on source changes

parent 576e30ee
...@@ -29,7 +29,7 @@ describe('IntegrationSettingsForm', () => { ...@@ -29,7 +29,7 @@ describe('IntegrationSettingsForm', () => {
}); });
it('should initialize form metadata on class object', () => { it('should initialize form metadata on class object', () => {
expect(integrationSettingsForm.endPoint).toBeDefined(); expect(integrationSettingsForm.testEndPoint).toBeDefined();
expect(integrationSettingsForm.canTestService).toBeDefined(); expect(integrationSettingsForm.canTestService).toBeDefined();
}); });
}); });
...@@ -62,22 +62,25 @@ describe('IntegrationSettingsForm', () => { ...@@ -62,22 +62,25 @@ describe('IntegrationSettingsForm', () => {
}); });
it('should set Save button label to "Test settings and save changes" when serviceActive & canTestService are `true`', () => { it('should set Save button label to "Test settings and save changes" when serviceActive & canTestService are `true`', () => {
integrationSettingsForm.toggleSubmitBtnLabel(true, true); integrationSettingsForm.canTestService = true;
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`', () => { it('should set Save button label to "Save changes" when either serviceActive or canTestService (or both) is `false`', () => {
integrationSettingsForm.toggleSubmitBtnLabel(false, false); integrationSettingsForm.canTestService = false;
integrationSettingsForm.toggleSubmitBtnLabel(false);
expect(integrationSettingsForm.$submitBtnLabel.text()).toEqual('Save changes'); expect(integrationSettingsForm.$submitBtnLabel.text()).toEqual('Save changes');
integrationSettingsForm.toggleSubmitBtnLabel(false, true); integrationSettingsForm.toggleSubmitBtnLabel(true);
expect(integrationSettingsForm.$submitBtnLabel.text()).toEqual('Save changes'); expect(integrationSettingsForm.$submitBtnLabel.text()).toEqual('Save changes');
integrationSettingsForm.toggleSubmitBtnLabel(true, false);
integrationSettingsForm.canTestService = true;
integrationSettingsForm.toggleSubmitBtnLabel(false);
expect(integrationSettingsForm.$submitBtnLabel.text()).toEqual('Save changes'); expect(integrationSettingsForm.$submitBtnLabel.text()).toEqual('Save changes');
}); });
}); });
...@@ -121,7 +124,7 @@ describe('IntegrationSettingsForm', () => { ...@@ -121,7 +124,7 @@ describe('IntegrationSettingsForm', () => {
expect($.ajax).toHaveBeenCalledWith({ expect($.ajax).toHaveBeenCalledWith({
type: 'PUT', type: 'PUT',
url: `${integrationSettingsForm.endPoint}/test`, url: integrationSettingsForm.testEndPoint,
data: formData, data: formData,
}); });
}); });
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment