Repository: ambari Updated Branches: refs/heads/trunk 2a7196d77 -> 4fcca627e
AMBARI-15128. Fix UI UT (onechiporenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/4fcca627 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/4fcca627 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/4fcca627 Branch: refs/heads/trunk Commit: 4fcca627e1094e87ee471a3f21e6d57cadf09b79 Parents: 2a7196d Author: Oleg Nechiporenko <onechipore...@apache.org> Authored: Mon Feb 22 16:57:28 2016 +0200 Committer: Oleg Nechiporenko <onechipore...@apache.org> Committed: Mon Feb 22 18:12:11 2016 +0200 ---------------------------------------------------------------------- ambari-web/test/controllers/installer_test.js | 2 +- .../progress_popup_controller_test.js | 4 +-- ...anage_alert_notifications_controller_test.js | 8 ++--- .../main/service/info/config_test.js | 2 +- .../widgets/create/step2_controller_test.js | 2 +- .../test/controllers/main/service_test.js | 12 -------- .../test/controllers/wizard/step3_test.js | 18 ------------ .../test/controllers/wizard/step7_test.js | 2 +- .../test/controllers/wizard/step9_test.js | 7 ++++- .../test/mappers/server_data_mapper_test.js | 8 ++--- .../mixins/common/configs/configs_saver_test.js | 10 +++---- .../host_components/install_component_test.js | 2 +- .../test/models/alerts/alert_instance_test.js | 3 +- ambari-web/test/utils/form_field_test.js | 2 +- .../widgets/slider_config_widget_view_test.js | 4 +-- ambari-web/test/views/common/table_view_test.js | 2 +- .../admin/stack_upgrade/services_view_test.js | 6 ++-- .../views/main/alert_definitions_view_test.js | 4 +-- .../test/views/main/dashboard/widget_test.js | 18 +++++++----- .../dashboard/widgets/hawqsegment_live_test.js | 2 +- .../ambari_metrics/regionserver_base_test.js | 2 +- ambari-web/test/views/wizard/step5_view_test.js | 4 +-- ambari-web/test/views/wizard/step9_view_test.js | 31 +++++++++++++++----- 23 files changed, 72 insertions(+), 83 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/4fcca627/ambari-web/test/controllers/installer_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/controllers/installer_test.js b/ambari-web/test/controllers/installer_test.js index df4ab0e..353129b 100644 --- a/ambari-web/test/controllers/installer_test.js +++ b/ambari-web/test/controllers/installer_test.js @@ -36,7 +36,7 @@ describe('App.InstallerController', function () { c = App.InstallerController.create({}); }); it('all steps are disabled by default', function () { - expect(c.get('isStepDisabled.length') > 0 ).to.be.ok; + expect(c.get('isStepDisabled.length')).to.be.above(0); expect(c.get('isStepDisabled').everyProperty('value', true)).to.be.ok; }); }); http://git-wip-us.apache.org/repos/asf/ambari/blob/4fcca627/ambari-web/test/controllers/main/admin/highAvailability/progress_popup_controller_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/controllers/main/admin/highAvailability/progress_popup_controller_test.js b/ambari-web/test/controllers/main/admin/highAvailability/progress_popup_controller_test.js index 8648181..f4a0e99 100644 --- a/ambari-web/test/controllers/main/admin/highAvailability/progress_popup_controller_test.js +++ b/ambari-web/test/controllers/main/admin/highAvailability/progress_popup_controller_test.js @@ -46,11 +46,11 @@ describe('App.HighAvailabilityProgressPopupController', function () { }); it('taskInfo.id = 2', function () { - expect(controller.get('taskInfo.id'), 2); + expect(controller.get('taskInfo.id')).to.be.equal(2); }); it('taskInfo.requestId = 1', function () { - expect(controller.get('taskInfo.requestId'), 1); + expect(controller.get('taskInfo.requestId')).to.be.equal(1); }); it('App.updater.run is called once', function () { http://git-wip-us.apache.org/repos/asf/ambari/blob/4fcca627/ambari-web/test/controllers/main/alerts/manage_alert_notifications_controller_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/controllers/main/alerts/manage_alert_notifications_controller_test.js b/ambari-web/test/controllers/main/alerts/manage_alert_notifications_controller_test.js index 19d0c1b..f16bf4d 100644 --- a/ambari-web/test/controllers/main/alerts/manage_alert_notifications_controller_test.js +++ b/ambari-web/test/controllers/main/alerts/manage_alert_notifications_controller_test.js @@ -1020,23 +1020,19 @@ describe('App.ManageAlertNotificationsController', function () { describe('#errorHandler', function () { it('should fire invalid name', function () { - view.set('controller.newCustomProperty.name', '!!'); view.errorsHandler(); expect(view.get('isError')).to.be.true; expect(view.get('parentView.disablePrimary')).to.be.true; - expect(view.get('errorMessage.length') > 0).to.be.true; - + expect(view.get('errorMessage.length')).to.be.above(0); }); it('should fire existing property name', function () { - view.set('controller.newCustomProperty.name', 'n1'); view.errorsHandler(); expect(view.get('isError')).to.be.true; expect(view.get('parentView.disablePrimary')).to.be.true; - expect(view.get('errorMessage.length') > 0).to.be.true; - + expect(view.get('errorMessage.length')).to.be.above(0); }); }); http://git-wip-us.apache.org/repos/asf/ambari/blob/4fcca627/ambari-web/test/controllers/main/service/info/config_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/controllers/main/service/info/config_test.js b/ambari-web/test/controllers/main/service/info/config_test.js index fd7b23a..9adfd28 100644 --- a/ambari-web/test/controllers/main/service/info/config_test.js +++ b/ambari-web/test/controllers/main/service/info/config_test.js @@ -478,7 +478,7 @@ describe("App.MainServiceInfoConfigsController", function () { }); it("ajax request to put cluster cfg", function () { mainServiceInfoConfigsController.set('stepConfigs', sc); - expect(mainServiceInfoConfigsController.putChangedConfigurations([])); + mainServiceInfoConfigsController.putChangedConfigurations([]); var args = testHelpers.findAjaxRequest('name', 'common.across.services.configurations'); expect(args[0]).exists; }); http://git-wip-us.apache.org/repos/asf/ambari/blob/4fcca627/ambari-web/test/controllers/main/service/widgets/create/step2_controller_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/controllers/main/service/widgets/create/step2_controller_test.js b/ambari-web/test/controllers/main/service/widgets/create/step2_controller_test.js index 70a160b..e717f02 100644 --- a/ambari-web/test/controllers/main/service/widgets/create/step2_controller_test.js +++ b/ambari-web/test/controllers/main/service/widgets/create/step2_controller_test.js @@ -731,7 +731,7 @@ describe('App.WidgetWizardStep2Controller', function () { }); it("user is moved to the next step", function () { controller.next(); - expect(App.router.send.calledWith('next')); + expect(App.router.send.calledWith('next')).to.be.true; }); }); }); http://git-wip-us.apache.org/repos/asf/ambari/blob/4fcca627/ambari-web/test/controllers/main/service_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/controllers/main/service_test.js b/ambari-web/test/controllers/main/service_test.js index 60e0e4d..ee90a0f 100644 --- a/ambari-web/test/controllers/main/service_test.js +++ b/ambari-web/test/controllers/main/service_test.js @@ -178,12 +178,6 @@ describe('App.MainServiceController', function () { expect(r).to.be.null; }); - it('nothing disabled', function() { - var event = {target: {}}, query = 'query'; - mainServiceController.startAllService(event).onPrimary(query); - expect(mainServiceController.allServicesCall.calledWith('STARTED', query)); - }); - }); describe('#stopAllService', function() { @@ -208,12 +202,6 @@ describe('App.MainServiceController', function () { expect(r).to.be.null; }); - it('nothing disabled', function() { - var event = {target: {}}, query = 'query'; - mainServiceController.stopAllService(event).onPrimary(query); - expect(mainServiceController.allServicesCall.calledWith('STARTED', query)); - }); - }); describe('#startStopAllService', function() { http://git-wip-us.apache.org/repos/asf/ambari/blob/4fcca627/ambari-web/test/controllers/wizard/step3_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/controllers/wizard/step3_test.js b/ambari-web/test/controllers/wizard/step3_test.js index 438554b..dbfb868 100644 --- a/ambari-web/test/controllers/wizard/step3_test.js +++ b/ambari-web/test/controllers/wizard/step3_test.js @@ -380,24 +380,6 @@ describe('App.WizardStep3Controller', function () { }); - describe('#removeHost', function () { - - beforeEach(function () { - sinon.stub(c, 'removeHosts', Em.K); - }); - - afterEach(function () { - c.removeHosts.restore(); - }); - - it('should call removeHosts with array as arg', function () { - var host = {a: ''}; - c.removeHost(host); - expect(c.removeHosts.calledWith([host])); - }); - - }); - describe('#removeSelectedHosts', function () { beforeEach(function () { http://git-wip-us.apache.org/repos/asf/ambari/blob/4fcca627/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 a089150..0ceec97 100644 --- a/ambari-web/test/controllers/wizard/step7_test.js +++ b/ambari-web/test/controllers/wizard/step7_test.js @@ -1733,7 +1733,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.equal(6); + expect(configs.length).to.be.equal(oldConfigs.length + 6); }); describe('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/4fcca627/ambari-web/test/controllers/wizard/step9_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/controllers/wizard/step9_test.js b/ambari-web/test/controllers/wizard/step9_test.js index dd4f6cd..dfc1d65 100644 --- a/ambari-web/test/controllers/wizard/step9_test.js +++ b/ambari-web/test/controllers/wizard/step9_test.js @@ -974,7 +974,12 @@ describe('App.InstallerStep9Controller', function () { tests.forEach(function (test) { it(test.m, function () { c.onInProgressPerHost(test.actions, test.host); - expect(test.host.message === test.e.message).to.equal(test.e.b); + if (test.e.b) { + expect(test.host.message).to.be.equal(test.e.message); + } + else { + expect(test.host.message).to.be.not.equal(test.e.message); + } }); }); }); http://git-wip-us.apache.org/repos/asf/ambari/blob/4fcca627/ambari-web/test/mappers/server_data_mapper_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/mappers/server_data_mapper_test.js b/ambari-web/test/mappers/server_data_mapper_test.js index d144afa..077cd20 100644 --- a/ambari-web/test/mappers/server_data_mapper_test.js +++ b/ambari-web/test/mappers/server_data_mapper_test.js @@ -113,11 +113,11 @@ describe('App.QuickDataMapper', function () { }); it('numeric array. element doesn\'t exists', function () { - expect(mapper.binaryIndexOf(array1, 0) < 0).to.be.true; + expect(mapper.binaryIndexOf(array1, 0)).to.be.below(0); }); it('numeric array. element doesn\'t exists 2', function () { - expect(mapper.binaryIndexOf(array1, 10) < 0).to.be.true; + expect(mapper.binaryIndexOf(array1, 10)).to.be.below(0); }); array2.forEach(function(item, index) { @@ -127,11 +127,11 @@ describe('App.QuickDataMapper', function () { }); it('string array. element doesn\'t exists', function () { - expect(mapper.binaryIndexOf(array2, 'a') < 0).to.be.true; + expect(mapper.binaryIndexOf(array2, 'a')).to.be.below(0); }); it('string array. element doesn\'t exists 2', function () { - expect(mapper.binaryIndexOf(array2, 'q') < 0).to.be.true; + expect(mapper.binaryIndexOf(array2, 'q')).to.be.below(0); }); }); http://git-wip-us.apache.org/repos/asf/ambari/blob/4fcca627/ambari-web/test/mixins/common/configs/configs_saver_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/mixins/common/configs/configs_saver_test.js b/ambari-web/test/mixins/common/configs/configs_saver_test.js index f7be831..4baf303 100644 --- a/ambari-web/test/mixins/common/configs/configs_saver_test.js +++ b/ambari-web/test/mixins/common/configs/configs_saver_test.js @@ -59,14 +59,14 @@ describe('App.ConfigsSaverMixin', function() { currentServices: stackServices[2], res: false, m: 'not ok' - }].forEach(function (c) { + }].forEach(function (c, index) { describe(c.m, function () { beforeEach(function () { instanceObject.reopen({ currentServices: c.currentServices }); - it('', function () { - expect(instanceObject.allowSaveCoreSite()).to.equal(c.res); + it('test #' + index, function () { + expect(instanceObject.allowSaveCoreSite()).to.be.equal(c.res); }); }); }); @@ -79,7 +79,7 @@ describe('App.ConfigsSaverMixin', function() { { fName: 'core-site', res: true, allowSaveCoreSite: true, m: 'core site is allowed to be saved' }, { fName: 'core-site', res: false, allowSaveCoreSite: false, m: 'core site is not allowed to be saved' }, { fName: 'other-file-name', res: true, m: 'file name has not restriction rule, so can be saved' } - ].forEach(function (c) { + ].forEach(function (c, index) { describe(c.m, function () { beforeEach(function() { sinon.stub(instanceObject, 'allowSaveCoreSite').returns(c.allowSaveCoreSite); @@ -87,7 +87,7 @@ describe('App.ConfigsSaverMixin', function() { afterEach(function() { instanceObject.allowSaveCoreSite.restore(); }); - it('', function () { + it('test #' + index, function () { expect(instanceObject.allowSaveSite(c.fName)).to.equal(c.res); }); }); http://git-wip-us.apache.org/repos/asf/ambari/blob/4fcca627/ambari-web/test/mixins/main/host/details/host_components/install_component_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/mixins/main/host/details/host_components/install_component_test.js b/ambari-web/test/mixins/main/host/details/host_components/install_component_test.js index 56d582c..c039107 100644 --- a/ambari-web/test/mixins/main/host/details/host_components/install_component_test.js +++ b/ambari-web/test/mixins/main/host/details/host_components/install_component_test.js @@ -109,7 +109,7 @@ describe('App.InstallComponent', function () { it("App.ajax.defaultErrorHandler should be called", function() { installComponent.ajaxErrorCallback({}, {}, 'error', {method: 'method1', url: 'url1'}, {}); - expect(App.ajax.defaultErrorHandler.calledWith({}, 'url1', 'method1')); + expect(App.ajax.defaultErrorHandler.calledWith({}, 'url1', 'method1')).to.be.true; }); }); http://git-wip-us.apache.org/repos/asf/ambari/blob/4fcca627/ambari-web/test/models/alerts/alert_instance_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/models/alerts/alert_instance_test.js b/ambari-web/test/models/alerts/alert_instance_test.js index 19838a4..f3abd79 100644 --- a/ambari-web/test/models/alerts/alert_instance_test.js +++ b/ambari-web/test/models/alerts/alert_instance_test.js @@ -51,8 +51,7 @@ describe('App.AlertInstance', function () { lastTriggeredFormatted: lastTriggeredFormatted }); var status = model.get('statusChangedAndLastCheckedFormatted'); - expect(status.indexOf(lastCheckedFormatted) > status.indexOf(lastTriggeredFormatted)).to.be.true; - + expect(status.indexOf(lastCheckedFormatted)).to.be.above(status.indexOf(lastTriggeredFormatted)); }); }); http://git-wip-us.apache.org/repos/asf/ambari/blob/4fcca627/ambari-web/test/utils/form_field_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/utils/form_field_test.js b/ambari-web/test/utils/form_field_test.js index 9359e72..f0bf190 100644 --- a/ambari-web/test/utils/form_field_test.js +++ b/ambari-web/test/utils/form_field_test.js @@ -34,7 +34,7 @@ describe('App.FormField', function () { formField.set('value', ''); formField.set('isRequired', true); formField.validate(); - expect(formField.get('errorMessage') === '').to.equal(false); + expect(formField.get('errorMessage')).to.be.not.equal(''); }); /*REQUIRE END*/ http://git-wip-us.apache.org/repos/asf/ambari/blob/4fcca627/ambari-web/test/views/common/configs/widgets/slider_config_widget_view_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/views/common/configs/widgets/slider_config_widget_view_test.js b/ambari-web/test/views/common/configs/widgets/slider_config_widget_view_test.js index a996e69..f038d3d 100644 --- a/ambari-web/test/views/common/configs/widgets/slider_config_widget_view_test.js +++ b/ambari-web/test/views/common/configs/widgets/slider_config_widget_view_test.js @@ -127,8 +127,8 @@ describe('App.SliderConfigWidgetView', function () { describe('#mirrorValue', function () { it('should be equal to config.value after init', function () { - expect('' + viewInt.get('mirrorValue')).to.equal(viewInt.get('config.value')); - expect('' + viewFloat.get('mirrorValue')).to.equal(viewFloat.get('config.value')); + expect(viewInt.get('mirrorValue').toString()).to.be.equal(viewInt.get('config.value')); + expect(viewFloat.get('mirrorValue').toString()).to.be.equal(viewFloat.get('config.value')); }); it('should be converted according to widget format', function() { http://git-wip-us.apache.org/repos/asf/ambari/blob/4fcca627/ambari-web/test/views/common/table_view_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/views/common/table_view_test.js b/ambari-web/test/views/common/table_view_test.js index 50a5ee3..37dd911 100644 --- a/ambari-web/test/views/common/table_view_test.js +++ b/ambari-web/test/views/common/table_view_test.js @@ -50,7 +50,7 @@ describe('App.TableView', function () { it('should set filterConditions on instance', function() { var tableView = App.TableView.create(); - expect(tableView.get('filterConditions') === App.TableView.prototype.filterConditions).to.be.false; + expect(tableView.get('filterConditions')).to.be.not.equal(App.TableView.prototype.filterConditions); }); }); http://git-wip-us.apache.org/repos/asf/ambari/blob/4fcca627/ambari-web/test/views/main/admin/stack_upgrade/services_view_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/views/main/admin/stack_upgrade/services_view_test.js b/ambari-web/test/views/main/admin/stack_upgrade/services_view_test.js index 64afed3..9a42c42 100644 --- a/ambari-web/test/views/main/admin/stack_upgrade/services_view_test.js +++ b/ambari-web/test/views/main/admin/stack_upgrade/services_view_test.js @@ -73,14 +73,16 @@ describe('App.MainAdminStackServicesView', function () { it("routes to Add Service Wizard and set redirect path on wizard close", function() { isAccessibleMock.returns(true); view.goToAddService({context: "serviceName"}); - expect(App.router.get.calledWith('addServiceController') && mock.setDBProperty.calledWith('onClosePath', 'main.admin.stackAndUpgrade.services')).to.be.true; + expect(App.router.get.calledWith('addServiceController')).to.be.true; + expect(mock.setDBProperty.calledWith('onClosePath', 'main.admin.stackAndUpgrade.services')).to.be.true; expect(App.get('router').transitionTo.calledWith('main.serviceAdd')).to.be.true; expect(mock.get('serviceToInstall')).to.be.equal("serviceName"); }); it("routes to Security Wizard", function() { isAccessibleMock.returns(true); view.goToAddService({context: "KERBEROS"}); - expect(App.router.get.calledWith('kerberosWizardController') && mock.setDBProperty.calledWith('onClosePath', 'main.admin.stackAndUpgrade.services')).to.be.true; + expect(App.router.get.calledWith('kerberosWizardController')).to.be.true; + expect(mock.setDBProperty.calledWith('onClosePath', 'main.admin.stackAndUpgrade.services')).to.be.true; expect(mock.checkAndStartKerberosWizard.calledOnce).to.be.true; }); }); http://git-wip-us.apache.org/repos/asf/ambari/blob/4fcca627/ambari-web/test/views/main/alert_definitions_view_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/views/main/alert_definitions_view_test.js b/ambari-web/test/views/main/alert_definitions_view_test.js index 224cb7e..0c3e5cc 100644 --- a/ambari-web/test/views/main/alert_definitions_view_test.js +++ b/ambari-web/test/views/main/alert_definitions_view_test.js @@ -51,8 +51,8 @@ describe('App.MainAlertDefinitionsView', function () { it('Add Ambari service to filters', function () { var serviceFilterClass = view.serviceFilterView; var content = serviceFilterClass.create({}).get('content'); - expect(content[0].label === Em.I18n.t('common.all')); - expect(content[content.length - 1].label === Em.I18n.t('app.name')); + expect(content[0].label).to.be.equal(Em.I18n.t('common.all')); + expect(content[content.length - 1].label).to.be.equal(Em.I18n.t('app.name')); }); }); http://git-wip-us.apache.org/repos/asf/ambari/blob/4fcca627/ambari-web/test/views/main/dashboard/widget_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/views/main/dashboard/widget_test.js b/ambari-web/test/views/main/dashboard/widget_test.js index 6450d1c..1a77efe 100644 --- a/ambari-web/test/views/main/dashboard/widget_test.js +++ b/ambari-web/test/views/main/dashboard/widget_test.js @@ -103,20 +103,22 @@ describe('App.DashboardWidgetView', function () { dashboardWidgetView.get('parentView').translateToReal.restore(); }); it("postUserPref is called with correct data", function () { - expect(dashboardWidgetView.get('parentView').postUserPref.calledWith('key', { + var arg = JSON.parse(JSON.stringify(dashboardWidgetView.get('parentView').postUserPref.args[0][1])); + expect(arg).to.be.eql({ dashboardVersion: 'new', - visible: ['2'], - hidden: ['1'], + visible: ['1', '2'], + hidden: [[5, null]], threshold: 'threshold' - })); + }); }); it("translateToReal is called with valid data", function () { - expect(dashboardWidgetView.get('parentView').translateToReal.calledWith({ + var arg = JSON.parse(JSON.stringify(dashboardWidgetView.get('parentView').translateToReal.args[0][0])); + expect(arg).to.be.eql({ dashboardVersion: 'new', - visible: ['2'], - hidden: ['1'], + visible: ['1', '2'], + hidden: [[5, null]], threshold: 'threshold' - })); + }); }); }); http://git-wip-us.apache.org/repos/asf/ambari/blob/4fcca627/ambari-web/test/views/main/dashboard/widgets/hawqsegment_live_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/views/main/dashboard/widgets/hawqsegment_live_test.js b/ambari-web/test/views/main/dashboard/widgets/hawqsegment_live_test.js index eb8a505..c4a1687 100644 --- a/ambari-web/test/views/main/dashboard/widgets/hawqsegment_live_test.js +++ b/ambari-web/test/views/main/dashboard/widgets/hawqsegment_live_test.js @@ -52,7 +52,7 @@ describe('App.HawqSegmentUpView', function() { ]; tests.forEach(function(test) { - describe('', function() { + describe('data -' + test.data, function() { var hawqSegmentUpView = App.HawqSegmentUpView.create({model_type:null, data: test.data, content: test.data.toString()}); it('shows red', function() { expect(hawqSegmentUpView.get('isRed')).to.equal(test.e.isRed); http://git-wip-us.apache.org/repos/asf/ambari/blob/4fcca627/ambari-web/test/views/main/service/info/metrics/ambari_metrics/regionserver_base_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/views/main/service/info/metrics/ambari_metrics/regionserver_base_test.js b/ambari-web/test/views/main/service/info/metrics/ambari_metrics/regionserver_base_test.js index 3b0ee44..dcec6fe 100644 --- a/ambari-web/test/views/main/service/info/metrics/ambari_metrics/regionserver_base_test.js +++ b/ambari-web/test/views/main/service/info/metrics/ambari_metrics/regionserver_base_test.js @@ -50,7 +50,7 @@ describe('App.ChartServiceMetricsAMS_RegionServerBaseView', function () { }); it('displayName', function () { - expect(this.result[0].name === regionServerView.displayName).to.be.true; + expect(this.result[0].name).to.be.equal(regionServerView.displayName); }); it('data.length', function () { http://git-wip-us.apache.org/repos/asf/ambari/blob/4fcca627/ambari-web/test/views/wizard/step5_view_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/views/wizard/step5_view_test.js b/ambari-web/test/views/wizard/step5_view_test.js index 5f3cd0d..bf45a51 100644 --- a/ambari-web/test/views/wizard/step5_view_test.js +++ b/ambari-web/test/views/wizard/step5_view_test.js @@ -191,7 +191,7 @@ describe('App.SelectHostView', function() { it('should call assignHostToMaster', function() { view.changeHandler(); - expect(view.get('controller').assignHostToMaster.calledWith('ZOOKEEPER_SERVER', 'h1', 1)); + expect(view.get('controller').assignHostToMaster.args[0]).to.be.eql(['ZOOKEEPER_SERVER', 'h1 info', 1]); }); it('should increment rebalanceComponentHostsCounter if component it is multiple', function() { @@ -271,7 +271,7 @@ describe('App.InputHostView', function() { it('should call assignHostToMaster', function() { view.changeHandler(); - expect(view.get('controller').assignHostToMaster.calledWith('ZOOKEEPER_SERVER', 'h1', 1)); + expect(view.get('controller').assignHostToMaster.args[0]).to.be.eql(['ZOOKEEPER_SERVER', 'h1', 1]); }); it('should increment rebalanceComponentHostsCounter if component it is multiple', function() { http://git-wip-us.apache.org/repos/asf/ambari/blob/4fcca627/ambari-web/test/views/wizard/step9_view_test.js ---------------------------------------------------------------------- diff --git a/ambari-web/test/views/wizard/step9_view_test.js b/ambari-web/test/views/wizard/step9_view_test.js index 646e945..47bae16 100644 --- a/ambari-web/test/views/wizard/step9_view_test.js +++ b/ambari-web/test/views/wizard/step9_view_test.js @@ -701,14 +701,29 @@ describe('App.HostStatusView', function () { e: false } ]).forEach(function (test) { - it(JSON.stringify(test.obj) + ' ' + test.progress, function() { - hv.set('barColor', ''); - hv.set('obj', test.obj); - hv.set('obj.message', ''); - hv.set('controller', {progress: test.progress}); - hv.onStatus(); - expect(hv.get('obj.message') === Em.I18n.t('installer.step9.host.status.success')).to.equal(test.e); - expect(hv.get('barColor') === 'progress-success').to.equal(test.e); + describe(JSON.stringify(test.obj) + ' ' + test.progress, function() { + beforeEach(function () { + hv.setProperties({ + barColor: '', + obj: test.obj + }); + hv.set('obj.message', ''); + hv.set('controller', {progress: test.progress}); + hv.onStatus(); + }); + + if (test.e) { + it('completed successful', function () { + expect(hv.get('obj.message')).to.be.equal(Em.I18n.t('installer.step9.host.status.success')); + expect(hv.get('barColor')).to.be.equal('progress-success'); + }); + } + else { + it('completed not successful', function () { + expect(hv.get('obj.message')).to.be.not.equal(Em.I18n.t('installer.step9.host.status.success')); + expect(hv.get('barColor')).to.be.not.equal('progress-success'); + }); + } }); }); });