Repository: ambari Updated Branches: refs/heads/trunk deb151713 -> fb628379a
AMBARI-14688. stack_and_upgrade_controller_test #saveRepoOS() fails intermittently (onechiporenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/fb628379 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/fb628379 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/fb628379 Branch: refs/heads/trunk Commit: fb628379aff3042288c75cde11157bd212458a0c Parents: deb1517 Author: Oleg Nechiporenko <onechipore...@apache.org> Authored: Fri Jan 15 18:59:41 2016 +0200 Committer: Oleg Nechiporenko <onechipore...@apache.org> Committed: Fri Jan 15 18:59:41 2016 +0200 ---------------------------------------------------------------------- .../global/cluster_controller_test.js | 2 +- .../admin/kerberos/step4_controller_test.js | 34 ++++++++---- .../admin/stack_and_upgrade_controller_test.js | 58 +++++++++++++------- .../test/controllers/wizard/step7_test.js | 2 +- .../test/controllers/wizard/step8_test.js | 12 ++-- ambari-web/test/controllers/wizard_test.js | 2 +- .../configs/config_groups_mapper_test.js | 24 ++++---- .../stack_config_properties_mapper_test.js | 20 +++---- .../wizard/wizardProgressPageController_test.js | 10 ++-- .../test/models/alerts/alert_config_test.js | 4 +- ambari-web/test/utils/blueprint_test.js | 4 +- ambari-web/test/utils/helper_test.js | 40 +++++++------- ambari-web/test/utils/object_utils_test.js | 2 +- ambari-web/test/utils/ui_effects_test.js | 2 +- ambari-web/test/views/main/host/summary_test.js | 2 +- 15 files changed, 125 insertions(+), 93 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/fb628379/ambari-web/test/controllers/global/cluster_controller_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/controllers/global/cluster_controller_test.js b/ambari-web/test/controllers/global/cluster_controller_test.js index 92808b4..f72d64f 100644 --- a/ambari-web/test/controllers/global/cluster_controller_test.js +++ b/ambari-web/test/controllers/global/cluster_controller_test.js @@ -248,7 +248,7 @@ describe('App.clusterController', function () { key: 'pass', type: 'persistent' }, {}); - expect(App.ajax.send.called).to.be.eql(false); + expect(App.ajax.send.called).to.be.false; expect(credentialUtils.createOrUpdateCredentials.getCall(0).args).to.eql([ 'test', 'kdc.admin.credential', { principal: 'admin', http://git-wip-us.apache.org/repos/asf/ambari/blob/fb628379/ambari-web/test/controllers/main/admin/kerberos/step4_controller_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/controllers/main/admin/kerberos/step4_controller_test.js b/ambari-web/test/controllers/main/admin/kerberos/step4_controller_test.js index f0fe836..6c4a1fb 100644 --- a/ambari-web/test/controllers/main/admin/kerberos/step4_controller_test.js +++ b/ambari-web/test/controllers/main/admin/kerberos/step4_controller_test.js @@ -34,14 +34,14 @@ describe('App.KerberosWizardStep4Controller', function() { controller.set('stepConfigs', controller.createServiceConfig(configs)); it('configuration errors are absent, submit should be not disabled', function() { - expect(controller.get('stepConfigs')[0].get('errorCount')).to.be.eql(0); + expect(controller.get('stepConfigs')[0].get('errorCount')).to.be.equal(0); expect(controller.get('isSubmitDisabled')).to.be.false; }); it('config has invalid value, submit should be disabled', function() { var serviceConfig = controller.get('stepConfigs')[0]; serviceConfig.get('configs').findProperty('name', 'prop1').set('value', ''); - expect(serviceConfig.get('errorCount')).to.be.eql(1); + expect(serviceConfig.get('errorCount')).to.be.equal(1); expect(controller.get('isSubmitDisabled')).to.be.true; }); }); @@ -230,7 +230,7 @@ describe('App.KerberosWizardStep4Controller', function() { ['admin_principal', 'admin_password'].forEach(function(item) { it('property `{0}` should have empty value'.format(item), function() { - expect(res.findProperty('name', item).get('value')).to.be.eql(''); + expect(res.findProperty('name', item).get('value')).to.be.equal(''); }); }); @@ -401,17 +401,27 @@ describe('App.KerberosWizardStep4Controller', function() { ]; cases.forEach(function(test) { - it(test.m, function () { - controller.get('wizardController').set('name', test.wizardController); - this.loadClusterDescriptorStub.returns(test.clusterDescriptorExists ? - $.Deferred().resolve().promise() : - $.Deferred().reject().promise()); - controller.getDescriptorConfigs(); - expect(controller.get('wizardController').setDBProperty.called).to.be.eql(test.e.setDBPropertyCalled); + describe(test.m, function () { + + beforeEach(function () { + controller.get('wizardController').set('name', test.wizardController); + this.loadClusterDescriptorStub.returns(test.clusterDescriptorExists ? + $.Deferred().resolve().promise() : + $.Deferred().reject().promise()); + controller.getDescriptorConfigs(); + }); + if (test.e.setDBPropertyCalled) { - expect(controller.get('wizardController').setDBProperty.args[0]).to.be.eql(test.e.setDBPropertyCalledWith); + it('setDBProperty is called with valid arguments', function () { + expect(controller.get('wizardController').setDBProperty.args[0]).to.be.eql(test.e.setDBPropertyCalledWith); + }); } - }) + else { + it('setDBProperty is not called', function () { + expect(controller.get('wizardController').setDBProperty.called).to.be.false; + }); + } + }); }) }); }); http://git-wip-us.apache.org/repos/asf/ambari/blob/fb628379/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js b/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js index 045b0f1..fe5d9c8 100644 --- a/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js +++ b/ambari-web/test/controllers/main/admin/stack_and_upgrade_controller_test.js @@ -1027,13 +1027,13 @@ describe('App.MainAdminStackAndUpgradeController', function() { }); }); it('request-name is valid', function () { - expect(this.callArgs.name).to.eql('admin.downgrade.start'); + expect(this.callArgs.name).to.be.equal('admin.downgrade.start'); }); it('request-sender is valid', function () { - expect(this.callArgs.sender).to.eql(controller); + expect(this.callArgs.sender).to.be.eql(controller); }); it('callback is valid', function () { - expect(this.callArgs.success).to.eql('upgradeSuccessCallback'); + expect(this.callArgs.success).to.be.equal('upgradeSuccessCallback'); }); it('callback is called', function () { expect(this.callArgs.callback).to.be.called; @@ -1128,13 +1128,13 @@ describe('App.MainAdminStackAndUpgradeController', function() { }); it('request-data is valid', function () { - expect(this.callArgs.data).to.eql({upgradeId: 1, itemId: 1, groupId: 1, status: 'PENDING'}); + expect(this.callArgs.data).to.be.eql({upgradeId: 1, itemId: 1, groupId: 1, status: 'PENDING'}); }); it('request-name is valid', function () { - expect(this.callArgs.name).to.eql('admin.upgrade.upgradeItem.setState'); + expect(this.callArgs.name).to.be.equal('admin.upgrade.upgradeItem.setState'); }); it('request-sendeer is valid', function () { - expect(this.callArgs.sender).to.eql(controller); + expect(this.callArgs.sender).to.be.eql(controller); }); it('callback is called', function () { expect(this.callArgs.callback).to.be.called; @@ -1229,22 +1229,42 @@ describe('App.MainAdminStackAndUpgradeController', function() { controller.prepareRepoForSaving.restore(); App.ajax.send.restore(); }); - it("validation errors present", function() { - this.mock.returns({ - done: function(callback) {callback([1]);} + describe("validation errors present", function() { + + beforeEach(function () { + this.mock.returns({ + done: function(callback) {callback([1]);} + }); + controller.saveRepoOS(Em.Object.create({repoVersionId: 1}), true); + }); + + it('validateRepoVersions is called with valid arguments', function () { + expect(controller.validateRepoVersions.calledWith(Em.Object.create({repoVersionId: 1}), true)).to.be.true; + }); + + it('prepareRepoForSaving is not called', function () { + expect(controller.prepareRepoForSaving.called).to.be.false; + }); + + it('no requests are sent', function () { + expect(App.ajax.send.called).to.be.false; }); - controller.saveRepoOS(Em.Object.create({repoVersionId: 1}), true); - expect(controller.validateRepoVersions.calledWith(Em.Object.create({repoVersionId: 1}), true)).to.be.true; - expect(controller.prepareRepoForSaving.called).to.be.false; - expect(App.ajax.send.called).to.be.false; }); - it("no validation errors", function() { - this.mock.returns({ - done: function(callback) {callback([]);} + + describe("no validation errors", function() { + + beforeEach(function () { + this.mock.returns({ + done: function(callback) {callback([]);} + }); + controller.saveRepoOS(Em.Object.create({repoVersionId: 1}), true); + }); + it('validateRepoVersions is called with valid arguments', function () { + expect(controller.validateRepoVersions.calledWith(Em.Object.create({repoVersionId: 1}), true)).to.be.true; + }); + it('prepareRepoForSaving is called with valid arguments', function () { + expect(controller.prepareRepoForSaving.calledWith(Em.Object.create({repoVersionId: 1}))).to.be.true; }); - controller.saveRepoOS(Em.Object.create({repoVersionId: 1}), true); - expect(controller.validateRepoVersions.calledWith(Em.Object.create({repoVersionId: 1}), true)).to.be.true; - expect(controller.prepareRepoForSaving.calledWith(Em.Object.create({repoVersionId: 1}))).to.be.true; }); }); http://git-wip-us.apache.org/repos/asf/ambari/blob/fb628379/ambari-web/test/controllers/wizard/step7_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/controllers/wizard/step7_test.js b/ambari-web/test/controllers/wizard/step7_test.js index 762cf1f..e93d3f7 100644 --- a/ambari-web/test/controllers/wizard/step7_test.js +++ b/ambari-web/test/controllers/wizard/step7_test.js @@ -1740,7 +1740,7 @@ describe('App.InstallerStep7Controller', function () { it('should copy properties from hdfs-site to hdfs-client for HAWQ', function() { installerStep7Controller.addHawqConfigsOnNnHa(configs); // ensure 6 new configs were added - expect(configs.length - oldConfigs.length).to.be.eql(6); + expect(configs.length - oldConfigs.length).to.be.equal(6); }); it('find the same property in hdfs-client for HAWQ and see if attribute value matches with the corresponding property\'s attribute value in hdfs-site', function () { http://git-wip-us.apache.org/repos/asf/ambari/blob/fb628379/ambari-web/test/controllers/wizard/step8_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/controllers/wizard/step8_test.js b/ambari-web/test/controllers/wizard/step8_test.js index f70c25f..9eb5b1e 100644 --- a/ambari-web/test/controllers/wizard/step8_test.js +++ b/ambari-web/test/controllers/wizard/step8_test.js @@ -1069,7 +1069,7 @@ describe('App.WizardStep8Controller', function () { it('should set [] to repoInfo', function() { installerStep8Controller.set('clusterInfo', Em.Object.create({repoInfo: [{}, {}]})); installerStep8Controller.loadRepoInfoErrorCallback({}); - expect(installerStep8Controller.get('clusterInfo.repoInfo.length')).to.eql(0); + expect(installerStep8Controller.get('clusterInfo.repoInfo.length')).to.be.equal(0); }); }); @@ -1340,6 +1340,7 @@ describe('App.WizardStep8Controller', function () { beforeEach(function() { sinon.stub($, 'ajax', function () { return { + then: Em.K, retry: function () { return {then: Em.K} } @@ -1909,20 +1910,21 @@ describe('App.WizardStep8Controller', function () { {name: 'some_p', value: 'some_v', serviceName: 'MISC', filename: 'alert_notification'} ]); installerStep8Controller.get('ajaxRequestsQueue').clear(); - sinon.stub($, 'ajax', function () {return {complete: Em.K}}); + sinon.stub(App.ajax, 'send', function () { + return {complete: Em.K} + }); }); afterEach(function () { App.get.restore(); - $.ajax.restore(); + App.ajax.send.restore(); }); it('should add request to queue', function () { installerStep8Controller.createNotification(); expect(installerStep8Controller.get('ajaxRequestsQueue.queue.length')).to.equal(1); installerStep8Controller.get('ajaxRequestsQueue').runNextRequest(); - expect($.ajax.calledOnce).to.be.true; - expect($.ajax.args[0][0].url.contains('overwrite_existing=true')).to.be.true; + expect(App.ajax.send.calledOnce).to.be.true; }); describe('sent data should be valid', function () { http://git-wip-us.apache.org/repos/asf/ambari/blob/fb628379/ambari-web/test/controllers/wizard_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/controllers/wizard_test.js b/ambari-web/test/controllers/wizard_test.js index 8ffa697..1abbfd7 100644 --- a/ambari-web/test/controllers/wizard_test.js +++ b/ambari-web/test/controllers/wizard_test.js @@ -912,7 +912,7 @@ describe('App.WizardController', function () { }); it('should load services from server', function () { wizardController.loadServicesFromServer(); - expect(res).to.eql('services'); + expect(res).to.be.equal('services'); }); }); http://git-wip-us.apache.org/repos/asf/ambari/blob/fb628379/ambari-web/test/mappers/configs/config_groups_mapper_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/mappers/configs/config_groups_mapper_test.js b/ambari-web/test/mappers/configs/config_groups_mapper_test.js index fc649f8..08a9598 100644 --- a/ambari-web/test/mappers/configs/config_groups_mapper_test.js +++ b/ambari-web/test/mappers/configs/config_groups_mapper_test.js @@ -111,13 +111,13 @@ describe.skip('App.configGroupsMapper', function () { App.Service.createRecord({'id': 'Service1'}); App.configGroupsMapper.map(null, ["Service1"]); expect(App.ServiceConfigGroup.find().get('length')).to.equal(1); - expect(App.ServiceConfigGroup.find('Service10').get('id')).to.eql('Service10'); - expect(App.ServiceConfigGroup.find('Service10').get('configGroupId')).to.eql(-1); - expect(App.ServiceConfigGroup.find('Service10').get('name')).to.eql('Service1 Default'); - expect(App.ServiceConfigGroup.find('Service10').get('description')).to.eql('Default cluster level Service1 configuration'); + expect(App.ServiceConfigGroup.find('Service10').get('id')).to.equal('Service10'); + expect(App.ServiceConfigGroup.find('Service10').get('configGroupId')).to.equal(-1); + expect(App.ServiceConfigGroup.find('Service10').get('name')).to.equal('Service1 Default'); + expect(App.ServiceConfigGroup.find('Service10').get('description')).to.equal('Default cluster level Service1 configuration'); expect(App.ServiceConfigGroup.find('Service10').get('hostNames')).to.eql(defaultAllHosts); - expect(App.ServiceConfigGroup.find('Service10').get('serviceName')).to.eql('Service1'); - expect(App.ServiceConfigGroup.find('Service10').get('service.id')).to.eql('Service1'); + expect(App.ServiceConfigGroup.find('Service10').get('serviceName')).to.equal('Service1'); + expect(App.ServiceConfigGroup.find('Service10').get('service.id')).to.equal('Service1'); }); it('should generate groups form json and default config groups', function() { @@ -133,13 +133,13 @@ describe.skip('App.configGroupsMapper', function () { App.Service.createRecord({'id': 'Service2'}); App.configGroupsMapper.map(json, ["Service1", "Service2"]); - expect(App.ServiceConfigGroup.find('Service12').get('id')).to.eql('Service12'); - expect(App.ServiceConfigGroup.find('Service12').get('configGroupId')).to.eql(2); - expect(App.ServiceConfigGroup.find('Service12').get('name')).to.eql('1'); - expect(App.ServiceConfigGroup.find('Service12').get('description')).to.eql('1'); + expect(App.ServiceConfigGroup.find('Service12').get('id')).to.equal('Service12'); + expect(App.ServiceConfigGroup.find('Service12').get('configGroupId')).to.equal(2); + expect(App.ServiceConfigGroup.find('Service12').get('name')).to.equal('1'); + expect(App.ServiceConfigGroup.find('Service12').get('description')).to.equal('1'); expect(App.ServiceConfigGroup.find('Service12').get('hostNames')).to.eql(["host1"]); - expect(App.ServiceConfigGroup.find('Service12').get('serviceName')).to.eql('Service1'); - expect(App.ServiceConfigGroup.find('Service12').get('service.id')).to.eql('Service1'); + expect(App.ServiceConfigGroup.find('Service12').get('serviceName')).to.equal('Service1'); + expect(App.ServiceConfigGroup.find('Service12').get('service.id')).to.equal('Service1'); }); }); http://git-wip-us.apache.org/repos/asf/ambari/blob/fb628379/ambari-web/test/mappers/configs/stack_config_properties_mapper_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/mappers/configs/stack_config_properties_mapper_test.js b/ambari-web/test/mappers/configs/stack_config_properties_mapper_test.js index 81341bd..dbe0ece 100644 --- a/ambari-web/test/mappers/configs/stack_config_properties_mapper_test.js +++ b/ambari-web/test/mappers/configs/stack_config_properties_mapper_test.js @@ -193,19 +193,19 @@ describe.skip('App.stackConfigPropertiesMapper', function () { }); it('name is valid', function () { - expect(App.StackConfigProperty.find('p1__site1').get('name')).to.eql('p1'); + expect(App.StackConfigProperty.find('p1__site1').get('name')).to.be.equal('p1'); }); it('displayName is valid', function () { - expect(App.StackConfigProperty.find('p1__site1').get('displayName')).to.eql('P1'); + expect(App.StackConfigProperty.find('p1__site1').get('displayName')).to.be.equal('P1'); }); it('description is valid', function () { - expect(App.StackConfigProperty.find('p1__site1').get('description')).to.eql('desc1'); + expect(App.StackConfigProperty.find('p1__site1').get('description')).to.be.equal('desc1'); }); it('recommendedValue is valid', function () { - expect(App.StackConfigProperty.find('p1__site1').get('recommendedValue')).to.eql('v1'); + expect(App.StackConfigProperty.find('p1__site1').get('recommendedValue')).to.be.equal('v1'); }); it('recommendedIsFinal is valid', function () { @@ -213,15 +213,15 @@ describe.skip('App.stackConfigPropertiesMapper', function () { }); it('serviceName is valid', function () { - expect(App.StackConfigProperty.find('p1__site1').get('serviceName')).to.eql('s1'); + expect(App.StackConfigProperty.find('p1__site1').get('serviceName')).to.be.equal('s1'); }); it('stackName is valid', function () { - expect(App.StackConfigProperty.find('p1__site1').get('stackName')).to.eql('HDP'); + expect(App.StackConfigProperty.find('p1__site1').get('stackName')).to.be.equal('HDP'); }); it('stackVersion is valid', function () { - expect(App.StackConfigProperty.find('p1__site1').get('stackVersion')).to.eql('2.2'); + expect(App.StackConfigProperty.find('p1__site1').get('stackVersion')).to.be.equal('2.2'); }); it('type is valid', function () { @@ -229,7 +229,7 @@ describe.skip('App.stackConfigPropertiesMapper', function () { }); it('fileName is valid', function () { - expect(App.StackConfigProperty.find('p1__site1').get('fileName')).to.eql('site1.xml'); + expect(App.StackConfigProperty.find('p1__site1').get('fileName')).to.be.equal('site1.xml'); }); it('propertyDependedBy is valid', function () { @@ -269,8 +269,8 @@ describe.skip('App.stackConfigPropertiesMapper', function () { var prop = App.StackConfigProperty.find().findProperty('name', 'p4'); var prop2 = App.StackConfigProperty.find().findProperty('name', 'p5'); expect(prop).to.be.ok; - expect(prop.get('displayType')).to.be.eql('password'); - expect(prop2.get('displayType')).to.be.eql('user'); + expect(prop.get('displayType')).to.be.equal('password'); + expect(prop2.get('displayType')).to.be.equal('user'); }); }); http://git-wip-us.apache.org/repos/asf/ambari/blob/fb628379/ambari-web/test/mixins/wizard/wizardProgressPageController_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/mixins/wizard/wizardProgressPageController_test.js b/ambari-web/test/mixins/wizard/wizardProgressPageController_test.js index 41d6a77..3d03292 100644 --- a/ambari-web/test/mixins/wizard/wizardProgressPageController_test.js +++ b/ambari-web/test/mixins/wizard/wizardProgressPageController_test.js @@ -96,13 +96,13 @@ describe('App.wizardProgressPageControllerMixin', function() { expect(this.args.data.hostName).to.be.eql(['host1', 'host2']); }); it('RequestInfo.query is valid', function () { - expect(this.queryObject.RequestInfo.query).to.be.eql('Hosts/host_name=host1|Hosts/host_name=host2'); + expect(this.queryObject.RequestInfo.query).to.be.equal('Hosts/host_name=host1|Hosts/host_name=host2'); }); it('affected component is valid', function () { - expect(this.queryObject.Body.host_components[0].HostRoles.component_name).to.be.eql('ZOOKEEPER_SERVER'); + expect(this.queryObject.Body.host_components[0].HostRoles.component_name).to.be.equal('ZOOKEEPER_SERVER'); }); it('taskNum = 1', function () { - expect(this.args.data.taskNum).to.be.eql(1); + expect(this.args.data.taskNum).to.be.equal(1); }); it('updateComponent is called', function () { // invoke callback @@ -121,10 +121,10 @@ describe('App.wizardProgressPageControllerMixin', function() { expect(this.args.data.hostName).to.be.eql(['host1', 'host2']); }); it('RequestInfo.query is valid', function () { - expect(this.queryObject.RequestInfo.query).to.be.eql('Hosts/host_name=host2'); + expect(this.queryObject.RequestInfo.query).to.be.equal('Hosts/host_name=host2'); }); it('affected component is valid', function () { - expect(this.queryObject.Body.host_components[0].HostRoles.component_name).to.be.eql('ZOOKEEPER_CLIENT'); + expect(this.queryObject.Body.host_components[0].HostRoles.component_name).to.be.equal('ZOOKEEPER_CLIENT'); }); it('onCreateComponent is not called', function () { expect(mixedObjectInstance.onCreateComponent.called).to.be.false; http://git-wip-us.apache.org/repos/asf/ambari/blob/fb628379/ambari-web/test/models/alerts/alert_config_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/models/alerts/alert_config_test.js b/ambari-web/test/models/alerts/alert_config_test.js index ae3f859..236fcde 100644 --- a/ambari-web/test/models/alerts/alert_config_test.js +++ b/ambari-web/test/models/alerts/alert_config_test.js @@ -64,7 +64,7 @@ describe('App.AlertConfigProperties', function () { showInputForText: false }); - expect(model.get('displayValue')).to.eql('40'); + expect(model.get('displayValue')).to.be.equal('40'); }); it('value change should not effect displayValue for not AGGREGATE type', function () { @@ -77,7 +77,7 @@ describe('App.AlertConfigProperties', function () { showInputForText: false }); - expect(model.get('displayValue')).to.eql('0.4'); + expect(model.get('displayValue')).to.be.equal('0.4'); }); }); http://git-wip-us.apache.org/repos/asf/ambari/blob/fb628379/ambari-web/test/utils/blueprint_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/utils/blueprint_test.js b/ambari-web/test/utils/blueprint_test.js index 6337293..ffa9cdb 100644 --- a/ambari-web/test/utils/blueprint_test.js +++ b/ambari-web/test/utils/blueprint_test.js @@ -438,8 +438,8 @@ describe('utils/blueprint', function() { describe('#_generateHostMap', function() { it('generate map', function() { var map = blueprintUtils._generateHostMap({}, ['h1','h2', 'h1'],'c1'); - expect(map.h1[0]).to.eql('c1'); - expect(map.h2[0]).to.eql('c1'); + expect(map.h1[0]).to.be.equal('c1'); + expect(map.h2[0]).to.be.equal('c1'); }); it('skip generations as hosts is empty', function() { http://git-wip-us.apache.org/repos/asf/ambari/blob/fb628379/ambari-web/test/utils/helper_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/utils/helper_test.js b/ambari-web/test/utils/helper_test.js index 7d78678..80aec9d 100644 --- a/ambari-web/test/utils/helper_test.js +++ b/ambari-web/test/utils/helper_test.js @@ -24,28 +24,28 @@ describe('utils/helper', function() { describe('String helpers', function() { describe('#trim()', function(){ it('should replace first space', function() { - expect(' as d f'.trim()).to.eql('as d f'); + expect(' as d f'.trim()).to.be.equal('as d f'); }); }); describe('#endsWith()', function() { it('`abcd` ends with `d`', function(){ - expect('abcd'.endsWith('d')).to.eql(true); + expect('abcd'.endsWith('d')).to.be.true; }); it('`abcd` doesn\'t end with `f`', function(){ - expect('abcd'.endsWith('f')).to.eql(false); + expect('abcd'.endsWith('f')).to.be.false; }); }); describe('#contains()', function() { it('`abc` contains b', function(){ - expect('abc'.contains('b')).to.eql(true); + expect('abc'.contains('b')).to.be.true; }); it('`abc` doesn\'t contain d', function() { - expect('abc'.contains('d')).to.eql(false); + expect('abc'.contains('d')).to.be.false; }); }); describe('#capitalize()',function() { it('`abc d` should start with `A`', function() { - expect('abc d'.capitalize()).to.eql('Abc d'); + expect('abc d'.capitalize()).to.be.equal('Abc d'); }); }); describe('#findIn()', function(){ @@ -76,23 +76,23 @@ describe('utils/helper', function() { }); describe('#format()', function(){ it('should replace string correctly', function(){ - expect("{0} world{1}".format("Hello","!")).to.eql("Hello world!"); + expect("{0} world{1}".format("Hello","!")).to.be.equal("Hello world!"); }); }); describe('#highlight()', function() { var str = "Hello world! I want to highlight this word!"; it('should highlight `word` with default template', function() { var result = str.highlight(['word']); - expect(result).to.eql("Hello world! I want to highlight this <b>word</b>!"); + expect(result).to.be.equal("Hello world! I want to highlight this <b>word</b>!"); }); it('should highlight `world` and `word` with template `<span class="yellow">{0}</span>`', function() { var result = str.highlight(["world", "word"], '<span class="yellow">{0}</span>'); - expect(result).to.eql('Hello <span class="yellow">world</span>! I want to highlight this <span class="yellow">word</span>!') + expect(result).to.be.equal('Hello <span class="yellow">world</span>! I want to highlight this <span class="yellow">word</span>!') }); var str2 = "First word, second word"; it('should highlight `word` multiply times with default template', function() { var result = str2.highlight(["word"]); - expect(result).to.eql("First <b>word</b>, second <b>word</b>"); + expect(result).to.be.equal("First <b>word</b>, second <b>word</b>"); }); }); }); @@ -182,7 +182,7 @@ describe('utils/helper', function() { it('should sort array', function() { result.forEach(function(resultObj, index, resultArr) { if (index > resultArr.length - 1) { - expect(resultObj.a < resultArr[index + 1].a).to.eql(false); + expect(resultObj.a < resultArr[index + 1].a).to.be.equal(false); } }); }); @@ -234,10 +234,10 @@ describe('utils/helper', function() { }; describe('#isEmptyObject', function(){ it('should return true on empty object', function() { - expect(App.isEmptyObject({})).to.eql(true); + expect(App.isEmptyObject({})).to.be.true; }); it('should return false on non-empty object', function() { - expect(App.isEmptyObject({ a: 1 })).to.eql(false); + expect(App.isEmptyObject({ a: 1 })).to.be.false; }); }); @@ -246,7 +246,7 @@ describe('utils/helper', function() { afterEach(removeDiv); it('should add tooltip', function() { App.tooltip($('#tooltip-test')); - expect($('#tooltip-test').data('tooltip').enabled).to.eql(true); + expect($('#tooltip-test').data('tooltip').enabled).to.be.true; }); }); describe('#popover()', function() { @@ -254,7 +254,7 @@ describe('utils/helper', function() { afterEach(removeDiv); it('should add popover', function() { App.popover($('#tooltip-test')); - expect($('#tooltip-test').data('popover').enabled).to.eql(true); + expect($('#tooltip-test').data('popover').enabled).to.be.true; }); }); describe('#App.format', function(){ @@ -265,19 +265,19 @@ describe('utils/helper', function() { var nagiosState = "nagios_update_ignore ACTIONEXECUTE"; var installRepo = "install_packages ACTIONEXECUTE"; it('should convert command to readable info', function() { - expect(App.format.commandDetail(command)).to.eql(' Ganglia Monitor Stop'); + expect(App.format.commandDetail(command)).to.be.equal(' Ganglia Monitor Stop'); }); it('should ignore decommission command', function(){ - expect(App.format.commandDetail(ignored)).to.eql(' NameNode'); + expect(App.format.commandDetail(ignored)).to.be.equal(' NameNode'); }); it('should remove SERVICE string from command', function(){ - expect(App.format.commandDetail(removeString)).to.eql(' HDFS Stop'); + expect(App.format.commandDetail(removeString)).to.be.equal(' HDFS Stop'); }); it('should return maintenance message', function() { - expect(App.format.commandDetail(nagiosState)).to.eql(' Toggle Maintenance Mode'); + expect(App.format.commandDetail(nagiosState)).to.be.equal(' Toggle Maintenance Mode'); }); it('should return install repo message', function() { - expect(App.format.commandDetail(installRepo)).to.eql(Em.I18n.t('common.installRepo.task')); + expect(App.format.commandDetail(installRepo)).to.be.equal(Em.I18n.t('common.installRepo.task')); }); }); describe('#taskStatus()', function(){ http://git-wip-us.apache.org/repos/asf/ambari/blob/fb628379/ambari-web/test/utils/object_utils_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/utils/object_utils_test.js b/ambari-web/test/utils/object_utils_test.js index 35e7689..0f9723b 100644 --- a/ambari-web/test/utils/object_utils_test.js +++ b/ambari-web/test/utils/object_utils_test.js @@ -35,7 +35,7 @@ describe('utils/object_utils', function() { }; it('should return correct tree of childs', function(){ var result = objectUtils.recursiveTree(testObj); - expect(result).to.eql('a2 (/a1)<br/>a5 (/a1/a3/a4)<br/>'); + expect(result).to.be.equal('a2 (/a1)<br/>a5 (/a1/a3/a4)<br/>'); }); it('should return `null` if type missed', function() { http://git-wip-us.apache.org/repos/asf/ambari/blob/fb628379/ambari-web/test/utils/ui_effects_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/utils/ui_effects_test.js b/ambari-web/test/utils/ui_effects_test.js index 2c9ce7a..3e03103 100644 --- a/ambari-web/test/utils/ui_effects_test.js +++ b/ambari-web/test/utils/ui_effects_test.js @@ -35,7 +35,7 @@ describe('utils/ui_effects', function(){ var domEl = $('#pulsate-test-dom'); uiUtils.pulsate(domEl, 1000); this.clock.tick(300); - expect(parseFloat(domEl.css('opacity')).toFixed(1)).to.eql('0.2'); + expect(parseFloat(domEl.css('opacity')).toFixed(1)).to.be.equal('0.2'); }); it('should call callback at the end', function() { var domEl = $('#pulsate-test-dom'); http://git-wip-us.apache.org/repos/asf/ambari/blob/fb628379/ambari-web/test/views/main/host/summary_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/views/main/host/summary_test.js b/ambari-web/test/views/main/host/summary_test.js index eb70014..2add4d0 100644 --- a/ambari-web/test/views/main/host/summary_test.js +++ b/ambari-web/test/views/main/host/summary_test.js @@ -373,7 +373,7 @@ describe('App.MainHostSummaryView', function() { it("Clients with custom commands only", function() { mainHostSummaryView.set('content', content); - expect(mainHostSummaryView.get('clientsWithCustomCommands').length).to.eql(1); + expect(mainHostSummaryView.get('clientsWithCustomCommands').length).to.be.equal(1); expect(mainHostSummaryView.get('clientsWithCustomCommands')).to.have.deep.property('[0].commands[0].command', 'CUSTOMCOMMAND'); }); });