You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by on...@apache.org on 2016/01/12 13:36:09 UTC
[1/3] ambari git commit: AMBARI-14626. UI UT cleanup (onechiporenko)
Repository: ambari
Updated Branches:
refs/heads/trunk b9e979578 -> 40aac602f
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/utils/string_utils_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/utils/string_utils_test.js b/ambari-web/test/utils/string_utils_test.js
index 9df143f..3c7b077 100644
--- a/ambari-web/test/utils/string_utils_test.js
+++ b/ambari-web/test/utils/string_utils_test.js
@@ -16,10 +16,10 @@
* limitations under the License.
*/
-var string_utils = require('utils/string_utils');
+var stringUtils = require('utils/string_utils');
require('utils/helper');
-describe('string_utils', function () {
+describe('stringUtils', function () {
describe('#underScoreToCamelCase', function () {
var tests = [
@@ -30,7 +30,7 @@ describe('string_utils', function () {
];
tests.forEach(function(test) {
it(test.m + ' ', function () {
- expect(string_utils.underScoreToCamelCase(test.i)).to.equal(test.e);
+ expect(stringUtils.underScoreToCamelCase(test.i)).to.equal(test.e);
});
});
});
@@ -50,7 +50,7 @@ describe('string_utils', function () {
];
tests.forEach(function(test) {
it(test.m + ' ', function () {
- expect(string_utils.pad(test.i, test.l, test.f, test.a)).to.equal(test.e);
+ expect(stringUtils.pad(test.i, test.l, test.f, test.a)).to.equal(test.e);
});
});
});
@@ -70,7 +70,7 @@ describe('string_utils', function () {
];
tests.forEach(function(test) {
it(test.m + ' ', function () {
- expect(string_utils.compareVersions(test.v1, test.v2)).to.equal(test.e);
+ expect(stringUtils.compareVersions(test.v1, test.v2)).to.equal(test.e);
});
});
});
@@ -84,7 +84,7 @@ describe('string_utils', function () {
];
tests.forEach(function(test) {
it(test.t + ' ' + test.m + ' ', function () {
- expect(string_utils.isSingleLine(test.t)).to.equal(test.e);
+ expect(stringUtils.isSingleLine(test.t)).to.equal(test.e);
});
});
});
@@ -92,7 +92,7 @@ describe('string_utils', function () {
describe('#arrayToCSV', function() {
var test = [{a: 1, b:2, c:3}, {a: 1, b:2, c:3}, {a: 1, b:2, c:3}];
it('array of object to csv-string', function () {
- expect(string_utils.arrayToCSV(test)).to.equal("1,2,3\n1,2,3\n1,2,3\n");
+ expect(stringUtils.arrayToCSV(test)).to.equal("1,2,3\n1,2,3\n1,2,3\n");
});
});
@@ -110,7 +110,7 @@ describe('string_utils', function () {
];
tests.forEach(function(test) {
it('Check ' + typeof test.t, function () {
- expect(string_utils.getFileFromPath(test.t)).to.equal(test.e);
+ expect(stringUtils.getFileFromPath(test.t)).to.equal(test.e);
});
});
});
@@ -131,7 +131,7 @@ describe('string_utils', function () {
];
tests.forEach(function(test) {
it('Check ' + typeof test.t, function () {
- expect(string_utils.getPath(test.t)).to.equal(test.e);
+ expect(stringUtils.getPath(test.t)).to.equal(test.e);
});
});
});
@@ -156,7 +156,7 @@ describe('string_utils', function () {
];
tests.forEach(function(test) {
it(test.i + ' to ' + test.e + ' ', function () {
- expect(string_utils.getCamelCase(test.i)).to.equal(test.e);
+ expect(stringUtils.getCamelCase(test.i)).to.equal(test.e);
});
});
});
@@ -251,7 +251,7 @@ describe('string_utils', function () {
];
tests.forEach(function(test) {
it('Check ' + typeof test.t, function () {
- expect(string_utils.htmlEntities(test.t)).to.equal(test.e);
+ expect(stringUtils.htmlEntities(test.t)).to.equal(test.e);
});
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/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 c4736ce..2c9ce7a 100644
--- a/ambari-web/test/utils/ui_effects_test.js
+++ b/ambari-web/test/utils/ui_effects_test.js
@@ -16,8 +16,7 @@
* limitations under the License.
*/
-var ui_utils = require('utils/ui_effects');
-var App = require('app');
+var uiUtils = require('utils/ui_effects');
describe('utils/ui_effects', function(){
describe('#pulsate()', function(){
@@ -34,13 +33,13 @@ describe('utils/ui_effects', function(){
it('opacity should be 0.2 on 5-th iteration', function() {
var domEl = $('#pulsate-test-dom');
- ui_utils.pulsate(domEl, 1000);
+ uiUtils.pulsate(domEl, 1000);
this.clock.tick(300);
expect(parseFloat(domEl.css('opacity')).toFixed(1)).to.eql('0.2');
});
it('should call callback at the end', function() {
var domEl = $('#pulsate-test-dom');
- ui_utils.pulsate(domEl, 1000, this.clb);
+ uiUtils.pulsate(domEl, 1000, this.clb);
this.clock.tick(2000);
expect(this.clb.calledOnce).to.be.ok;
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/utils/validator_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/utils/validator_test.js b/ambari-web/test/utils/validator_test.js
index 5591aee..5ff6185 100644
--- a/ambari-web/test/utils/validator_test.js
+++ b/ambari-web/test/utils/validator_test.js
@@ -232,8 +232,9 @@ describe('validator', function () {
{ obj: 1, detect: false },
{ obj: true, detect: false }
];
- testable.forEach(function(value){
- it('should ' + (value.detect ? '' : 'not') + ' detect empty value in `' + new String(value.obj) + '`', function(){
+ testable.forEach(function(value) {
+ var detect = value.detect ? '' : 'not';
+ it('should {0} detect empty value in `{1}`'.format(detect, JSON.stringify(value.obj)), function() {
expect(validator.empty(value.obj)).to.eql(value.detect);
});
});
@@ -420,7 +421,7 @@ describe('validator', function () {
{ value: 'a{1,2}{', expected: false }
];
tests.forEach(function(test) {
- it(message.format(test.value, (test.expected) ? 'valid' : 'not valid'), function() {
+ it(message.format(test.value, test.expected ? 'valid' : 'not valid'), function() {
expect(validator.isValidMatchesRegexp(test.value)).to.equal(test.expected);
})
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/views/common/chart/linear_time_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/chart/linear_time_test.js b/ambari-web/test/views/common/chart/linear_time_test.js
index d21f830..377e392 100644
--- a/ambari-web/test/views/common/chart/linear_time_test.js
+++ b/ambari-web/test/views/common/chart/linear_time_test.js
@@ -382,7 +382,7 @@ describe('App.ChartLinearTimeView', function () {
view.setYAxisFormatter();
view.yAxisFormatter();
methodNames.forEach(function (name) {
- expect(App.ChartLinearTimeView[name].callCount).to.equal(Number(name == item.formatter));
+ expect(App.ChartLinearTimeView[name].callCount).to.equal(Number(name === item.formatter));
});
});
});
@@ -443,16 +443,16 @@ describe('App.ChartLinearTimeView.LoadAggregator', function () {
result = aggregator.groupRequests(requests);
});
it("result['r1'].subRequests.length", function () {
- expect(result['r1'].subRequests.length).to.equal(1);
+ expect(result.r1.subRequests.length).to.equal(1);
});
it("result['r1'].fields.length", function () {
- expect(result['r1'].fields.length).to.equal(1);
+ expect(result.r1.fields.length).to.equal(1);
});
it("result['r2'].subRequests.length", function () {
- expect(result['r2'].subRequests.length).to.equal(2);
+ expect(result.r2.subRequests.length).to.equal(2);
});
it("result['r2'].fields.length", function () {
- expect(result['r2'].fields.length).to.equal(3);
+ expect(result.r2.fields.length).to.equal(3);
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/views/common/configs/overriddenProperty_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/configs/overriddenProperty_view_test.js b/ambari-web/test/views/common/configs/overriddenProperty_view_test.js
index 7520cef..16ab7e4 100644
--- a/ambari-web/test/views/common/configs/overriddenProperty_view_test.js
+++ b/ambari-web/test/views/common/configs/overriddenProperty_view_test.js
@@ -44,7 +44,7 @@ describe('App.ServiceConfigView.SCPOverriddenRowsView', function () {
describe('#setSwitchText', function () {
- var view = App.ServiceConfigView.SCPOverriddenRowsView.create({
+ view = App.ServiceConfigView.SCPOverriddenRowsView.create({
serviceConfigProperty: {
overrides: [
Em.Object.create({
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/views/common/configs/service_config_container_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/configs/service_config_container_view_test.js b/ambari-web/test/views/common/configs/service_config_container_view_test.js
index 0cdef1e..e7aaa62 100644
--- a/ambari-web/test/views/common/configs/service_config_container_view_test.js
+++ b/ambari-web/test/views/common/configs/service_config_container_view_test.js
@@ -22,10 +22,7 @@ require('views/common/configs/services_config');
describe('App.ServiceConfigContainerView', function () {
- var view,
- selectedService = {
- configCategories: []
- };
+ var view;
beforeEach(function () {
view = App.ServiceConfigContainerView.create({
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/views/common/configs/service_configs_by_category_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/configs/service_configs_by_category_view_test.js b/ambari-web/test/views/common/configs/service_configs_by_category_view_test.js
index 3451964..5b443b6 100644
--- a/ambari-web/test/views/common/configs/service_configs_by_category_view_test.js
+++ b/ambari-web/test/views/common/configs/service_configs_by_category_view_test.js
@@ -26,8 +26,6 @@ describe('App.ServiceConfigsByCategoryView', function () {
serviceConfigs: []
});
- var result = [1, 2, 3, 4];
-
var testData = [
{
title: 'four configs in correct order',
@@ -97,6 +95,7 @@ describe('App.ServiceConfigsByCategoryView', function () {
App.TestAliases.testAsComputedIfThenElse(view, 'isCategoryBodyVisible', 'category.isCollapsed', 'display: none;', 'display: block;');
describe('#sortByIndex', function () {
+ var result = [1, 2, 3, 4];
testData.forEach(function(_test){
it(_test.title, function () {
expect(view.sortByIndex(_test.configs).mapProperty('resultId')).to.deep.equal(result);
@@ -352,9 +351,8 @@ describe('App.ServiceConfigsByCategoryView', function () {
});
describe('#categoryConfigs', function () {
- var view,
- result = [1,2,3,4,5],
- cases = [
+ var result = [1, 2, 3, 4, 5];
+ var cases = [
{
categoryNname: 'TestCategory',
serviceConfigs: [
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/views/common/filter_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/filter_view_test.js b/ambari-web/test/views/common/filter_view_test.js
index 3bf8152..81abddf 100644
--- a/ambari-web/test/views/common/filter_view_test.js
+++ b/ambari-web/test/views/common/filter_view_test.js
@@ -328,9 +328,10 @@ describe('filters.getFilterByType', function () {
}
];
- testData.forEach(function(item){
- it('Condition: ' + item.condition + ((item.result) ? ' - match ' : ' - doesn\'t match ' + 'value: ') +
- item.value.mapProperty('componentName').join(" "), function () {
+ testData.forEach(function(item) {
+ var substr = item.condition + (item.result ? ' - match ' : ' - doesn\'t match ');
+ var components = item.value.mapProperty('componentName').join(' ');
+ it('Condition: {0} value: {1}'.format(substr, components), function () {
expect(filter(item.value, item.condition)).to.equal(item.result);
})
});
@@ -389,9 +390,10 @@ describe('filters.getFilterByType', function () {
];
testData.forEach(function(item){
- it('Condition: ' + item.condition + ((item.result) ? ' - match ' : ' - doesn\'t match ' + 'value: ') + item.value, function () {
+ var substr = item.condition + (item.result ? ' - match ' : ' - doesn\'t match ');
+ it('Condition: {0} value: {1}'.format(substr, item.value), function () {
expect(filter(item.value, item.condition)).to.equal(item.result);
- })
+ });
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/views/common/quick_link_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/quick_link_view_test.js b/ambari-web/test/views/common/quick_link_view_test.js
index 1c985a1..cae4715 100644
--- a/ambari-web/test/views/common/quick_link_view_test.js
+++ b/ambari-web/test/views/common/quick_link_view_test.js
@@ -299,7 +299,7 @@ describe('App.QuickViewLinks', function () {
quickViewLinks.setEmptyLinks();
expect(quickViewLinks.get('quickLinks')).to.eql([{
label: quickViewLinks.t('quick.links.error.label'),
- url: 'javascript:alert("' + quickViewLinks.t('contact.administrator') + '");return false;'
+ url: 'javascript:alert("' + quickViewLinks.t('contact.administrator') + '");return false;' // eslint-disable-line no-script-url
}]);
expect(quickViewLinks.get('isLoaded')).to.be.true;
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/views/common/sort_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/common/sort_view_test.js b/ambari-web/test/views/common/sort_view_test.js
index 9bfae34..1820250 100644
--- a/ambari-web/test/views/common/sort_view_test.js
+++ b/ambari-web/test/views/common/sort_view_test.js
@@ -16,7 +16,6 @@
* limitations under the License.
*/
-var App = require('app');
var sort = require('views/common/sort_view');
require('utils/misc');
require('utils/string_utils');
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/views/login_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/login_test.js b/ambari-web/test/views/login_test.js
index 844b0f6..6050211 100644
--- a/ambari-web/test/views/login_test.js
+++ b/ambari-web/test/views/login_test.js
@@ -21,16 +21,17 @@ var App = require('app');
require('views/login');
var view,
- controller,
pass;
describe('App.LoginView', function () {
before(function () {
sinon.stub(App, 'get', function(k) {
- if (k === 'router') return {
- login: Em.K
- };
+ if (k === 'router') {
+ return {
+ login: Em.K
+ };
+ }
return Em.get(App, k);
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/views/main/admin/stack_upgrade/upgrade_wizard_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/admin/stack_upgrade/upgrade_wizard_view_test.js b/ambari-web/test/views/main/admin/stack_upgrade/upgrade_wizard_view_test.js
index a5b0def..25182a1 100644
--- a/ambari-web/test/views/main/admin/stack_upgrade/upgrade_wizard_view_test.js
+++ b/ambari-web/test/views/main/admin/stack_upgrade/upgrade_wizard_view_test.js
@@ -286,7 +286,7 @@ describe('App.upgradeWizardView', function () {
afterEach(function () {
this.mock.restore();
});
- var testCases = [
+ [
{
data: {
failedItem: null,
@@ -442,7 +442,7 @@ describe('App.upgradeWizardView', function () {
});
describe("#upgradeStatusLabel", function () {
- var testCases = [
+ [
{
data: {
status: 'QUEUED',
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/views/main/admin/stack_upgrade/version_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/admin/stack_upgrade/version_view_test.js b/ambari-web/test/views/main/admin/stack_upgrade/version_view_test.js
index b151ee4..c4eaa74 100644
--- a/ambari-web/test/views/main/admin/stack_upgrade/version_view_test.js
+++ b/ambari-web/test/views/main/admin/stack_upgrade/version_view_test.js
@@ -207,7 +207,7 @@ describe('App.mainAdminStackVersionsView', function () {
beforeEach(function () {
sinon.stub(App, 'get', function (key) {
- return key == 'supports.displayOlderVersions' ? displayOlderVersions : Em.get(App, key);
+ return key === 'supports.displayOlderVersions' ? displayOlderVersions : Em.get(App, key);
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/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 66d1188..d4344c3 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 === Em.I18n.t('common.all'));
+ expect(content[content.length - 1].label === Em.I18n.t('app.name'));
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/views/main/alerts/manage_alert_groups_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/alerts/manage_alert_groups_view_test.js b/ambari-web/test/views/main/alerts/manage_alert_groups_view_test.js
index 5bb005d..64e5c84 100644
--- a/ambari-web/test/views/main/alerts/manage_alert_groups_view_test.js
+++ b/ambari-web/test/views/main/alerts/manage_alert_groups_view_test.js
@@ -18,8 +18,6 @@
var App = require('app');
-var view;
-
function getView() {
return App.MainAlertsManageAlertGroupView.create({
controller: Em.Object.create()
@@ -28,10 +26,6 @@ function getView() {
describe('App.MainAlertsManageAlertGroupView', function () {
- beforeEach(function () {
- view = getView();
- });
-
App.TestAliases.testAsComputedIfThenElse(getView(), 'removeButtonTooltip', 'controller.isRemoveButtonDisabled', Em.I18n.t('alerts.actions.manage_alert_groups_popup.removeButtonDisabled'), Em.I18n.t('alerts.actions.manage_alert_groups_popup.removeButton'))
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/views/main/alerts/manage_alert_notifications_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/alerts/manage_alert_notifications_view_test.js b/ambari-web/test/views/main/alerts/manage_alert_notifications_view_test.js
index 6e8b993..eb68f2f 100644
--- a/ambari-web/test/views/main/alerts/manage_alert_notifications_view_test.js
+++ b/ambari-web/test/views/main/alerts/manage_alert_notifications_view_test.js
@@ -89,7 +89,7 @@ describe('App.ManageAlertNotificationsView', function () {
selectedAlertNotification: null,
m: 'some alert notification is not selected and user is a non-admin operator',
p: {
- isAddButtonDisabled: true,
+ isAddButtonDisabled: true,
isEditButtonDisabled: false,
isRemoveButtonDisabled: false,
isDuplicateButtonDisabled: false
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/views/main/dashboard/widgets/hbase_master_uptime_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/dashboard/widgets/hbase_master_uptime_test.js b/ambari-web/test/views/main/dashboard/widgets/hbase_master_uptime_test.js
index 3a43b54..4f19a35 100644
--- a/ambari-web/test/views/main/dashboard/widgets/hbase_master_uptime_test.js
+++ b/ambari-web/test/views/main/dashboard/widgets/hbase_master_uptime_test.js
@@ -28,7 +28,7 @@ describe('App.HBaseMasterUptimeView', function () {
var tests = [
{
model: Em.Object.create({
- masterStartTime: ((new Date()).getTime() - 192.1 * 24 * 3600 * 1000)
+ masterStartTime: new Date().getTime() - 192.1 * 24 * 3600 * 1000
}),
e: {
isGreen: true,
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/views/main/dashboard/widgets/namenode_uptime_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/dashboard/widgets/namenode_uptime_test.js b/ambari-web/test/views/main/dashboard/widgets/namenode_uptime_test.js
index 607ecfd..bfd101c 100644
--- a/ambari-web/test/views/main/dashboard/widgets/namenode_uptime_test.js
+++ b/ambari-web/test/views/main/dashboard/widgets/namenode_uptime_test.js
@@ -28,7 +28,7 @@ describe('App.NameNodeUptimeView', function() {
var tests = [
{
model: Em.Object.create({
- nameNodeStartTime: ((new Date()).getTime() - 192.1*24*3600*1000)
+ nameNodeStartTime: new Date().getTime() - 192.1*24*3600*1000
}),
e: {
isRed: false,
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/views/main/dashboard/widgets/resource_manager_uptime_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/dashboard/widgets/resource_manager_uptime_test.js b/ambari-web/test/views/main/dashboard/widgets/resource_manager_uptime_test.js
index bf4b637..1dd4df1 100644
--- a/ambari-web/test/views/main/dashboard/widgets/resource_manager_uptime_test.js
+++ b/ambari-web/test/views/main/dashboard/widgets/resource_manager_uptime_test.js
@@ -28,7 +28,7 @@ describe('App.ResourceManagerUptimeView', function() {
var tests = [
{
model: Em.Object.create({
- resourceManagerStartTime: ((new Date()).getTime() - 192.1*24*3600*1000)
+ resourceManagerStartTime: (new Date()).getTime() - 192.1*24*3600*1000
}),
e: {
isRed: false,
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/views/main/dashboard/widgets/uptime_text_widget_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/dashboard/widgets/uptime_text_widget_test.js b/ambari-web/test/views/main/dashboard/widgets/uptime_text_widget_test.js
index 5179353..808e67b 100644
--- a/ambari-web/test/views/main/dashboard/widgets/uptime_text_widget_test.js
+++ b/ambari-web/test/views/main/dashboard/widgets/uptime_text_widget_test.js
@@ -80,8 +80,8 @@ describe('App.UptimeTextDashboardWidgetView', function() {
];
timestamps.forEach(function(timestamp) {
var uptimeTextDashboardWidgetView = App.UptimeTextDashboardWidgetView.create({thresh1:40, thresh2:70});
- it('timestamp ' + timestamp.t + '. timeUnit should be ' + '"' + timestamp.e.timeUnit + '"', function() {
- var result = uptimeTextDashboardWidgetView.uptimeProcessing(((new Date()).getTime() - timestamp.diff));
+ it('timestamp {0}. timeUnit should be "{1}"'.format(timestamp.t, timestamp.e.timeUnit), function() {
+ uptimeTextDashboardWidgetView.uptimeProcessing(new Date().getTime() - timestamp.diff);
expect(uptimeTextDashboardWidgetView.get('timeUnit')).to.equal(timestamp.e.timeUnit);
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/views/main/dashboard/widgets_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/dashboard/widgets_test.js b/ambari-web/test/views/main/dashboard/widgets_test.js
index 35f0673..eb27237 100644
--- a/ambari-web/test/views/main/dashboard/widgets_test.js
+++ b/ambari-web/test/views/main/dashboard/widgets_test.js
@@ -19,7 +19,6 @@
var App = require('app');
require('messages');
-var filters = require('views/common/filter_view');
require('mixins/common/userPref');
require('mixins/common/localStorage');
require('views/main/dashboard/widgets');
@@ -29,11 +28,11 @@ describe('App.MainDashboardWidgetsView', function () {
var view = App.MainDashboardWidgetsView.create();
describe('#setInitPrefObject', function () {
- var host_metrics_widgets_count = 4;
- var hdfs_widgets_count = 7;
- var hbase_widgets_count = 4;
- var yarn_widgets_count = 4;
- var total_widgets_count = 20;
+ var hostMetricsWidgetsCount = 4;
+ var hdfsWidgetsCount = 7;
+ var hbaseWidgetsCount = 4;
+ var yarnWidgetsCount = 4;
+ var totalWidgetsCount = 20;
var tests = Em.A([
{
models: {
@@ -43,7 +42,7 @@ describe('App.MainDashboardWidgetsView', function () {
yarn_model: null
},
e: {
- visibleL: total_widgets_count - host_metrics_widgets_count - hdfs_widgets_count - hbase_widgets_count - yarn_widgets_count - 1,
+ visibleL: totalWidgetsCount - hostMetricsWidgetsCount - hdfsWidgetsCount - hbaseWidgetsCount - yarnWidgetsCount - 1,
hiddenL: 0
},
m: 'All models are null'
@@ -56,7 +55,7 @@ describe('App.MainDashboardWidgetsView', function () {
yarn_model: null
},
e: {
- visibleL: total_widgets_count - hdfs_widgets_count - hbase_widgets_count - yarn_widgets_count - 1,
+ visibleL: totalWidgetsCount - hdfsWidgetsCount - hbaseWidgetsCount - yarnWidgetsCount - 1,
hiddenL: 0
},
m: 'hdfs_model, hbase_model, yarn_model are null'
@@ -69,7 +68,7 @@ describe('App.MainDashboardWidgetsView', function () {
yarn_model: null
},
e: {
- visibleL: total_widgets_count - hbase_widgets_count - yarn_widgets_count - 1,
+ visibleL: totalWidgetsCount - hbaseWidgetsCount - yarnWidgetsCount - 1,
hiddenL: 0
},
m: 'hbase_model, yarn_model are null'
@@ -82,7 +81,7 @@ describe('App.MainDashboardWidgetsView', function () {
yarn_model: null
},
e: {
- visibleL: total_widgets_count - hbase_widgets_count - yarn_widgets_count - 1,
+ visibleL: totalWidgetsCount - hbaseWidgetsCount - yarnWidgetsCount - 1,
hiddenL: 0
},
m: 'hbase_model and yarn_model are null'
@@ -95,7 +94,7 @@ describe('App.MainDashboardWidgetsView', function () {
yarn_model: null
},
e: {
- visibleL: total_widgets_count - yarn_widgets_count - 1,
+ visibleL: totalWidgetsCount - yarnWidgetsCount - 1,
hiddenL: 1
},
m: 'yarn_model is null'
@@ -108,7 +107,7 @@ describe('App.MainDashboardWidgetsView', function () {
yarn_model: {}
},
e: {
- visibleL: total_widgets_count,
+ visibleL: totalWidgetsCount,
hiddenL: 1
},
m: 'All models are not null'
@@ -253,7 +252,6 @@ describe('App.MainDashboardWidgetsView', function () {
});
describe("#applyFilterComplete()", function () {
- var widget = {checked: true};
beforeEach(function () {
sinon.stub(view, 'postUserPref');
sinon.stub(view, 'translateToReal');
@@ -496,7 +494,7 @@ describe('App.MainDashboardWidgetsView', function () {
Em.keys(widgetsMap).forEach(function (item, index, array) {
it(notEmptyModelTitle.format(item), function () {
array.forEach(function (modelName) {
- view.set(modelName, modelName == item ? {} : null);
+ view.set(modelName, modelName === item ? {} : null);
});
expect(view.checkServicesChange(emptyCurrentPref).visible).to.eql(widgetsMap[item]);
});
@@ -506,7 +504,7 @@ describe('App.MainDashboardWidgetsView', function () {
it(emptyModelTitle.format(item), function () {
var expected = [];
array.forEach(function (modelName) {
- if (modelName == item) {
+ if (modelName === item) {
view.set(modelName, null);
} else {
view.set(modelName, {});
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/views/main/dashboard_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/dashboard_test.js b/ambari-web/test/views/main/dashboard_test.js
index 1236e2d..70e2eb2 100644
--- a/ambari-web/test/views/main/dashboard_test.js
+++ b/ambari-web/test/views/main/dashboard_test.js
@@ -16,16 +16,4 @@
* limitations under the License.
*/
-
-var App = require('app');
-require('messages');
-var filters = require('views/common/filter_view');
-require('views/main/dashboard');
-var mainDashboardView;
-describe('App.MainDashboardView', function() {
-
- beforeEach(function() {
- mainDashboardView = App.MainDashboardView.create();
- });
-
-});
+describe('App.MainDashboardView', function() {});
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/views/main/host/details/host_component_views/decommissionable_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/host/details/host_component_views/decommissionable_test.js b/ambari-web/test/views/main/host/details/host_component_views/decommissionable_test.js
index 7c02870..b5cbbe5 100644
--- a/ambari-web/test/views/main/host/details/host_component_views/decommissionable_test.js
+++ b/ambari-web/test/views/main/host/details/host_component_views/decommissionable_test.js
@@ -28,13 +28,15 @@ describe('App.Decommissionable', function() {
beforeEach(function() {
sinon.stub(App.router, 'get', function (k) {
- if (k === 'mainHostDetailsController.content') return Em.Object.create({
- hostComponents: [
- {
- componentName: 'component'
- }
- ]
- });
+ if (k === 'mainHostDetailsController.content') {
+ return Em.Object.create({
+ hostComponents: [
+ {
+ componentName: 'component'
+ }
+ ]
+ });
+ }
return Em.get(App.router, k);
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/views/main/host/details/host_component_views/nodemanager_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/host/details/host_component_views/nodemanager_view_test.js b/ambari-web/test/views/main/host/details/host_component_views/nodemanager_view_test.js
index 3f72c27..3aafe70 100644
--- a/ambari-web/test/views/main/host/details/host_component_views/nodemanager_view_test.js
+++ b/ambari-web/test/views/main/host/details/host_component_views/nodemanager_view_test.js
@@ -64,7 +64,7 @@ describe('App.NodeManagerComponentView', function () {
expect(view.setStatusAs.calledWith('DECOMMISSIONED')).to.be.true;
});
it("RM contains host", function () {
- var curObj = {rm_metrics: {
+ var curObj = {rm_metrics: {
cluster: {
nodeManagers: [{
HostName: 'host1'
@@ -75,7 +75,7 @@ describe('App.NodeManagerComponentView', function () {
expect(view.setStatusAs.calledWith('DECOMMISSIONING')).to.be.true;
});
it("RM does not contain host", function () {
- var curObj = {rm_metrics: {
+ var curObj = {rm_metrics: {
cluster: {
nodeManagers: []
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/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 3481f15..eb70014 100644
--- a/ambari-web/test/views/main/host/summary_test.js
+++ b/ambari-web/test/views/main/host/summary_test.js
@@ -331,7 +331,7 @@ describe('App.MainHostSummaryView', function() {
sinon.stub(App.StackServiceComponent, 'find', function(component) {
var customCommands = [];
- if (component == 'WITH_CUSTOM_COMMANDS') {
+ if (component === 'WITH_CUSTOM_COMMANDS') {
customCommands = ['CUSTOMCOMMAND'];
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/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 4ba93ac..3b0ee44 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
@@ -54,7 +54,7 @@ describe('App.ChartServiceMetricsAMS_RegionServerBaseView', function () {
});
it('data.length', function () {
- expect(this.result[0].data.length).to.equal(jsonData.metrics.hbase.regionserver['test'].length);
+ expect(this.result[0].data.length).to.equal(jsonData.metrics.hbase.regionserver.test.length);
});
it('y-property', function () {
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/views/main/service/info/summary_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/service/info/summary_test.js b/ambari-web/test/views/main/service/info/summary_test.js
index df3aa24..72e468d 100644
--- a/ambari-web/test/views/main/service/info/summary_test.js
+++ b/ambari-web/test/views/main/service/info/summary_test.js
@@ -447,7 +447,7 @@ describe('App.MainServiceInfoSummaryView', function() {
describe("#restartAllStaleConfigComponents", function () {
describe('trigger restartAllServiceHostComponents', function () {
- var view;
+
beforeEach(function () {
view = App.MainServiceInfoSummaryView.create({
controller: Em.Object.create({
@@ -476,7 +476,6 @@ describe('App.MainServiceInfoSummaryView', function() {
describe('trigger check last check point warning before triggering restartAllServiceHostComponents', function () {
- var view;
var mainServiceItemController;
beforeEach(function () {
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/views/main/service/item_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/main/service/item_test.js b/ambari-web/test/views/main/service/item_test.js
index 8319699..af94f01 100644
--- a/ambari-web/test/views/main/service/item_test.js
+++ b/ambari-web/test/views/main/service/item_test.js
@@ -59,16 +59,16 @@ describe('App.MainServiceItemView', function () {
var actionMap = App.HostComponentActionMap.getMap(view);
var customActionsArray = [];
- for (var iter in actionMap) {
+ Object.keys(actionMap).forEach(function (iter) {
customActionsArray.push(actionMap[iter]);
- }
+ });
var customActions = customActionsArray.mapProperty('customCommand').filter(function (action) {
return !nonCustomAction.contains(action);
}).uniq();
// remove null and undefined from the list
customActions = customActions.filter(function (value) {
- return value != null;
+ return !Em.isNone(value);
});
customActions.forEach(function (action) {
@@ -402,7 +402,7 @@ describe('App.MainServiceItemView', function () {
{"action": "restartAllHostComponents", "context": "KNOX", "label": "Restart All", "cssClass": "icon-repeat", "disabled": false},
{"action": "runSmokeTest", "label": "Run Service Check", "cssClass": "icon-thumbs-up-alt", "disabled": false},
{"action": "turnOnOffPassive", "context": "Turn On Maintenance Mode for Knox", "label": "Turn On Maintenance Mode", "cssClass": "icon-medkit", "disabled": false},
- {"action": "startLdapKnox", "customCommand": "STARTDEMOLDAP", "context": "Start Demo LDAP", "label": "Start Demo LDAP", "cssClass": "icon-play-sign", "disabled": false},
+ {"action": "startLdapKnox", "customCommand": "STARTDEMOLDAP", "context": "Start Demo LDAP", "label": "Start Demo LDAP", "cssClass": "icon-play-sign", "disabled": false},
{"action": "stopLdapKnox", "customCommand": "STOPDEMOLDAP", "context": "Stop Demo LDAP", "label": "Stop Demo LDAP", "cssClass": "icon-stop", "disabled": false},
{"action": "downloadClientConfigs", "label": "Download Client Configs", "cssClass": "icon-download-alt", "isHidden": true, "disabled": false, "hasSubmenu": false, "submenuOptions": []}
]
@@ -436,7 +436,7 @@ describe('App.MainServiceItemView', function () {
sinon.stub(App, 'get', function (k) {
switch (k) {
case 'isSingleNode':
- return view.get('controller.content.serviceName') == 'HDFS';
+ return view.get('controller.content.serviceName') === 'HDFS';
case 'supports.autoRollbackHA':
case 'isRMHaEnabled':
case 'isHaEnabled':
@@ -479,8 +479,9 @@ describe('App.MainServiceItemView', function () {
];
});
- sinon.stub(App.StackServiceComponent, 'find', function () {
- switch (arguments[0]) {
+ /*eslint-disable complexity */
+ sinon.stub(App.StackServiceComponent, 'find', function (id) {
+ switch (id) {
case 'NAMENODE':
return Em.Object.create({ customCommands: ["DECOMMISSION", "REBALANCEHDFS"] });
case 'RESOURCEMANAGER':
@@ -510,6 +511,7 @@ describe('App.MainServiceItemView', function () {
];
}
});
+ /*eslint-enable complexity */
});
afterEach(function () {
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/views/wizard/step1_view_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/views/wizard/step1_view_test.js b/ambari-web/test/views/wizard/step1_view_test.js
index 1cfb7ff..0dacad8 100644
--- a/ambari-web/test/views/wizard/step1_view_test.js
+++ b/ambari-web/test/views/wizard/step1_view_test.js
@@ -279,7 +279,7 @@ describe('App.WizardStep1View', function () {
});
- App.TestAliases.testAsComputedSomeBy(getView(), 'invalidUrlExist', 'allRepositories', 'validation', App.Repository.validation['INVALID']);
+ App.TestAliases.testAsComputedSomeBy(getView(), 'invalidUrlExist', 'allRepositories', 'validation', App.Repository.validation.INVALID);
App.TestAliases.testAsComputedSomeBy(getView(), 'invalidFormatUrlExist', 'allRepositories', 'invalidFormatError', true);
@@ -448,7 +448,7 @@ describe('App.WizardStep1View', function () {
})
];
- var controller = {
+ var ctrl = {
content: {
stacks: [
Em.Object.create({
@@ -485,7 +485,7 @@ describe('App.WizardStep1View', function () {
it('target group isn\'t isSelected', function () {
view.reopen({
operatingSystems: operatingSystems,
- controller: controller
+ controller: ctrl
});
view.updateByCheckbox();
var targetGroup = view.get('operatingSystems.firstObject.repositories.firstObject');
@@ -496,11 +496,11 @@ describe('App.WizardStep1View', function () {
});
it('target group is isSelected, skipValidationisSelected = true', function () {
- controller.content.stacks[0].operatingSystems[0].selected = true;
+ ctrl.content.stacks[0].operatingSystems[0].selected = true;
operatingSystems[0].set('isSelected', true);
view.reopen({
operatingSystems: operatingSystems,
- controller: controller
+ controller: ctrl
});
view.updateByCheckbox();
var targetGroup = view.get('operatingSystems.firstObject.repositories.firstObject');
[3/3] ambari git commit: AMBARI-14626. UI UT cleanup (onechiporenko)
Posted by on...@apache.org.
AMBARI-14626. UI UT cleanup (onechiporenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/40aac602
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/40aac602
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/40aac602
Branch: refs/heads/trunk
Commit: 40aac602f69579ee2c245832b40afa5e194b13a0
Parents: b9e9795
Author: Oleg Nechiporenko <on...@apache.org>
Authored: Tue Jan 12 12:52:02 2016 +0200
Committer: Oleg Nechiporenko <on...@apache.org>
Committed: Tue Jan 12 12:52:02 2016 +0200
----------------------------------------------------------------------
ambari-web/app/views/common/modal_popup.js | 6 +-
ambari-web/test/aliases/computed/alias.js | 2 +-
.../test/aliases/computed/firstNotBlank.js | 2 +-
ambari-web/test/app_test.js | 1 -
.../test/controllers/experimental_test.js | 10 +-
.../global/background_operations_test.js | 4 +-
.../global/cluster_controller_test.js | 12 +-
.../global/update_controller_test.js | 7 +-
ambari-web/test/controllers/installer_test.js | 8 +-
.../nameNode/step3_controller_test.js | 6 +-
.../admin/kerberos/step2_controller_test.js | 5 +-
.../admin/kerberos/step4_controller_test.js | 107 +++++++++---------
.../controllers/main/admin/kerberos_test.js | 2 +-
.../admin/stack_and_upgrade_controller_test.js | 4 +-
.../definitions_details_controller_test.js | 6 -
...anage_alert_notifications_controller_test.js | 8 +-
.../heatmap_metrics/heatmap_metric_test.js | 2 +-
.../controllers/main/charts/heatmap_test.js | 6 +-
.../test/controllers/main/host/details_test.js | 18 ++-
ambari-web/test/controllers/main/host_test.js | 1 -
.../main/service/add_controller_test.js | 2 +-
.../main/service/info/config_test.js | 4 +-
.../main/service/info/summary_test.js | 10 +-
.../test/controllers/main/service/item_test.js | 99 ++---------------
.../manage_config_groups_controller_test.js | 2 +-
.../service/reassign/step1_controller_test.js | 1 -
.../service/reassign/step2_controller_test.js | 3 -
.../service/reassign/step4_controller_test.js | 4 +-
.../widgets/create/step2_controller_test.js | 2 +-
.../widgets/create/wizard_controller_test.js | 8 +-
.../test/controllers/main/service_test.js | 2 +-
ambari-web/test/controllers/main_test.js | 11 +-
.../test/controllers/wizard/step10_test.js | 2 +-
.../test/controllers/wizard/step2_test.js | 3 +-
.../test/controllers/wizard/step3_test.js | 19 ++--
.../test/controllers/wizard/step4_test.js | 21 ++--
.../test/controllers/wizard/step5_test.js | 2 -
.../test/controllers/wizard/step6_test.js | 8 +-
.../test/controllers/wizard/step7_test.js | 110 ++++++++++++-------
.../test/controllers/wizard/step8_test.js | 17 ++-
.../test/controllers/wizard/step9_test.js | 27 +++--
ambari-web/test/controllers/wizard_test.js | 81 ++++++--------
.../test/data/HDP2.2/site_properties_test.js | 9 +-
.../test/data/HDP2.3/site_properties_test.js | 9 +-
.../test/data/HDP2/secure_mapping_test.js | 5 +-
.../test/data/HDP2/site_properties_test.js | 9 +-
ambari-web/test/init_computed_aliases.js | 5 +-
ambari-web/test/init_test.js | 6 +-
ambari-web/test/login_test.js | 23 +---
.../mappers/alert_definitions_mapper_test.js | 6 +-
.../test/mappers/alert_groups_mapper_test.js | 11 +-
.../test/mappers/alert_instances_mapper_test.js | 8 +-
ambari-web/test/mappers/hosts_mapper_test.js | 1 -
.../test/mappers/server_data_mapper_test.js | 7 +-
ambari-web/test/mappers/service_mapper_test.js | 1 -
ambari-web/test/mappers/stack_mapper_test.js | 5 +-
ambari-web/test/mappers/status_mapper_test.js | 10 +-
ambari-web/test/mappers/users_mapper_test.js | 1 -
.../configs/config_recommendations_test.js | 4 +-
.../mixins/common/configs/configs_saver_test.js | 2 +-
.../common/configs/toggle_isrequired_test.js | 3 +-
.../kdc_credentials_controller_mixin_test.js | 25 +++--
.../test/mixins/common/serverValidator_test.js | 6 +-
.../test/mixins/common/widget_mixin_test.js | 46 ++++----
.../host_components/decommissionable_test.js | 24 ----
.../configs/widget_popover_support_test.js | 12 +-
.../test/mixins/wizard/wizardEnableDone_test.js | 4 +-
.../wizard/wizardProgressPageController_test.js | 6 +-
.../test/mock_data_setup/configs_mock_data.js | 6 +-
ambari-web/test/models/authentication_test.js | 4 +-
.../objects/service_config_property_test.js | 53 +--------
.../configs/objects/service_config_test.js | 1 -
.../test/models/configs/theme/tab_test.js | 5 -
ambari-web/test/models/form_test.js | 2 +
ambari-web/test/models/host_component_test.js | 4 +-
ambari-web/test/models/host_test.js | 3 +-
ambari-web/test/models/service/hdfs_test.js | 1 -
ambari-web/test/models/service/yarn_test.js | 56 +---------
ambari-web/test/models/service_test.js | 66 -----------
.../stack_version/repository_version_test.js | 7 +-
ambari-web/test/router_test.js | 1 -
ambari-web/test/routes/views_test.js | 2 +-
.../test/utils/batch_scheduled_requests_test.js | 3 +-
ambari-web/test/utils/blueprint_test.js | 4 +-
ambari-web/test/utils/config_test.js | 27 +++--
.../utils/configs/config_initializer_test.js | 69 ++----------
ambari-web/test/utils/configs/database_test.js | 1 -
ambari-web/test/utils/data_manipulation_test.js | 10 +-
ambari-web/test/utils/date/date_test.js | 13 +--
ambari-web/test/utils/helper_test.js | 31 +++---
.../test/utils/host_progress_popup_test.js | 83 ++------------
ambari-web/test/utils/load_timer_test.js | 4 +-
ambari-web/test/utils/misc_test.js | 2 +-
ambari-web/test/utils/number_utils_test.js | 2 +-
ambari-web/test/utils/string_utils_test.js | 22 ++--
ambari-web/test/utils/ui_effects_test.js | 7 +-
ambari-web/test/utils/validator_test.js | 7 +-
.../test/views/common/chart/linear_time_test.js | 10 +-
.../configs/overriddenProperty_view_test.js | 2 +-
.../service_config_container_view_test.js | 5 +-
.../service_configs_by_category_view_test.js | 8 +-
.../test/views/common/filter_view_test.js | 12 +-
.../test/views/common/quick_link_view_test.js | 2 +-
ambari-web/test/views/common/sort_view_test.js | 1 -
ambari-web/test/views/login_test.js | 9 +-
.../stack_upgrade/upgrade_wizard_view_test.js | 4 +-
.../admin/stack_upgrade/version_view_test.js | 2 +-
.../views/main/alert_definitions_view_test.js | 4 +-
.../alerts/manage_alert_groups_view_test.js | 6 -
.../manage_alert_notifications_view_test.js | 2 +-
.../widgets/hbase_master_uptime_test.js | 2 +-
.../dashboard/widgets/namenode_uptime_test.js | 2 +-
.../widgets/resource_manager_uptime_test.js | 2 +-
.../widgets/uptime_text_widget_test.js | 4 +-
.../test/views/main/dashboard/widgets_test.js | 28 +++--
ambari-web/test/views/main/dashboard_test.js | 14 +--
.../decommissionable_test.js | 16 +--
.../nodemanager_view_test.js | 4 +-
ambari-web/test/views/main/host/summary_test.js | 2 +-
.../ambari_metrics/regionserver_base_test.js | 2 +-
.../views/main/service/info/summary_test.js | 3 +-
ambari-web/test/views/main/service/item_test.js | 16 +--
ambari-web/test/views/wizard/step1_view_test.js | 10 +-
123 files changed, 539 insertions(+), 1032 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/app/views/common/modal_popup.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/common/modal_popup.js b/ambari-web/app/views/common/modal_popup.js
index 9c7f03e..3402e80 100644
--- a/ambari-web/app/views/common/modal_popup.js
+++ b/ambari-web/app/views/common/modal_popup.js
@@ -68,7 +68,7 @@ App.ModalPopup = Ember.View.extend({
if (this.autoHeight && !$.mocho) {
var block = this.$().find('#modal > .modal-body').first();
if(block.offset()) {
- block.css('max-height', $(window).height() - block.offset().top - this.marginBottom + $(window).scrollTop()); // fix popup height
+ block.css('max-height', $(window).height() - block.offset().top - this.marginBottom + $(window).scrollTop()); // fix popup height
}
}
this.fitZIndex();
@@ -82,7 +82,7 @@ App.ModalPopup = Ember.View.extend({
*/
fitZIndex: function () {
var existedPopups = $('.modal-backdrop');
- if (existedPopups) {
+ if (existedPopups && !$.mocho) {
var maxZindex = 1;
existedPopups.each(function(index, popup) {
if ($(popup).css('z-index') > maxZindex) {
@@ -103,7 +103,7 @@ App.ModalPopup = Ember.View.extend({
var block = this.$().find('#modal > .modal-body');
var wh = $(window).height();
- var top = wh * .05;
+ var top = wh * 0.05;
popup.css({
'top': top + 'px',
'marginTop': 0
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/aliases/computed/alias.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/aliases/computed/alias.js b/ambari-web/test/aliases/computed/alias.js
index 9605d73..d65b976 100644
--- a/ambari-web/test/aliases/computed/alias.js
+++ b/ambari-web/test/aliases/computed/alias.js
@@ -40,7 +40,7 @@ App.TestAliases.testAsComputedAlias = function (context, propertyName, dependent
}
else {
// all
- testsCases = [].concat.call([], Object.keys(typesMap).map(function (key) {return typesMap[key]}));
+ testsCases = [].concat(Object.keys(typesMap).map(function (key) {return typesMap[key]}));
}
describe('#' + propertyName + ' as Em.computed.alias', function () {
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/aliases/computed/firstNotBlank.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/aliases/computed/firstNotBlank.js b/ambari-web/test/aliases/computed/firstNotBlank.js
index 7099fe5..e6edba2 100644
--- a/ambari-web/test/aliases/computed/firstNotBlank.js
+++ b/ambari-web/test/aliases/computed/firstNotBlank.js
@@ -21,7 +21,7 @@ var helpers = App.TestAliases.helpers;
function prepareHash(dependentKeys, index) {
var hash = {};
dependentKeys.forEach(function (key, i) {
- hash[key] = i < index ? null : '' + i;
+ hash[key] = i < index ? null : '' + i;
});
return hash;
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/app_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/app_test.js b/ambari-web/test/app_test.js
index 972f57f..60e617a 100644
--- a/ambari-web/test/app_test.js
+++ b/ambari-web/test/app_test.js
@@ -20,7 +20,6 @@ var App = require('app');
require('views/common/quick_view_link_view');
require('models/host_component');
require('models/stack_service_component');
-var modelSetup = require('test/init_model_test');
App.auth = ["AMBARI.ADD_DELETE_CLUSTERS", "AMBARI.ASSIGN_ROLES", "AMBARI.EDIT_STACK_REPOS", "AMBARI.MANAGE_GROUPS", "AMBARI.MANAGE_STACK_VERSIONS", "AMBARI.MANAGE_USERS", "AMBARI.MANAGE_VIEWS", "AMBARI.RENAME_CLUSTER", "AMBARI.SET_SERVICE_USERS_GROUPS", "CLUSTER.TOGGLE_ALERTS", "CLUSTER.TOGGLE_KERBEROS", "CLUSTER.UPGRADE_DOWNGRADE_STACK", "CLUSTER.VIEW_ALERTS", "CLUSTER.VIEW_CONFIGS", "CLUSTER.VIEW_METRICS", "CLUSTER.VIEW_STACK_DETAILS", "CLUSTER.VIEW_STATUS_INFO", "HOST.ADD_DELETE_COMPONENTS", "HOST.ADD_DELETE_HOSTS", "HOST.TOGGLE_MAINTENANCE", "HOST.VIEW_CONFIGS", "HOST.VIEW_METRICS", "HOST.VIEW_STATUS_INFO", "SERVICE.ADD_DELETE_SERVICES", "SERVICE.COMPARE_CONFIGS", "SERVICE.DECOMMISSION_RECOMMISSION", "SERVICE.ENABLE_HA", "SERVICE.MANAGE_CONFIG_GROUPS", "SERVICE.MODIFY_CONFIGS", "SERVICE.MOVE", "SERVICE.RUN_CUSTOM_COMMAND", "SERVICE.RUN_SERVICE_CHECK", "SERVICE.START_STOP", "SERVICE.TOGGLE_ALERTS", "SERVICE.TOGGLE_MAINTENANCE", "SERVICE.VIEW_ALERTS", "SERVICE.VIEW_CONFIGS", "SERV
ICE.VIEW_METRICS", "SERVICE.VIEW_STATUS_INFO", "VIEW.USE"];
describe('App', function () {
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/controllers/experimental_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/experimental_test.js b/ambari-web/test/controllers/experimental_test.js
index bfb238f..0ff0758 100644
--- a/ambari-web/test/controllers/experimental_test.js
+++ b/ambari-web/test/controllers/experimental_test.js
@@ -21,9 +21,7 @@ var App = require('app');
require('controllers/experimental');
var controller,
- transition,
supports = {},
- transitionStubbed = false,
controllerSupports = [
Em.Object.create({
name: 'sup0',
@@ -65,10 +63,10 @@ describe('App.ExperimentalController', function () {
describe.skip('#doSave', function () {
before(function () {
sinon.stub(Ember, 'set', function (p, v) {
- if (p.indexOf('App.supports.' != -1)) {
- p = p.replace('App.supports.', '');
- saveObject[p] = v;
- return;
+ if (p.startsWith('App.supports.')) {
+ var key = p.replace('App.supports.', '');
+ saveObject[key] = v;
+ return v;
}
return Ember.set(p, v);
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/controllers/global/background_operations_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/global/background_operations_test.js b/ambari-web/test/controllers/global/background_operations_test.js
index adc02c9..a602a32 100644
--- a/ambari-web/test/controllers/global/background_operations_test.js
+++ b/ambari-web/test/controllers/global/background_operations_test.js
@@ -660,7 +660,7 @@ describe('App.BackgroundOperationsController', function () {
controller.set('services', [request]);
controller.callBackFilteredByRequest(data);
expect(request.get('previousTaskStatusMap')).to.eql({"1": "COMPLETED"});
- expect(request.get('hostsMap')['host1'].logTasks.length).to.equal(1);
+ expect(request.get('hostsMap.host1.logTasks.length')).to.equal(1);
expect(request.get('isRunning')).to.equal(false);
});
@@ -694,7 +694,7 @@ describe('App.BackgroundOperationsController', function () {
controller.set('services', [request]);
controller.callBackFilteredByRequest(data);
expect(request.get('previousTaskStatusMap')).to.eql({"1": "COMPLETED", "2": "IN_PROGRESS"});
- expect(request.get('hostsMap')['host1'].logTasks.length).to.equal(2);
+ expect(request.get('hostsMap.host1.logTasks.length')).to.equal(2);
expect(request.get('isRunning')).to.equal(true);
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/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 a020b46..92808b4 100644
--- a/ambari-web/test/controllers/global/cluster_controller_test.js
+++ b/ambari-web/test/controllers/global/cluster_controller_test.js
@@ -52,20 +52,20 @@ describe('App.clusterController', function () {
expect(controller.get('clusterDataLoadedPercent')).to.equal('width:0');
});
it('when first item is loaded then isLoaded should be false', function () {
- controller.updateLoadStatus.call(controller, 'item1');
+ controller.updateLoadStatus('item1');
expect(controller.get('isLoaded')).to.equal(false);
});
it('when first item is loaded then width should be "width:50%"', function () {
- controller.updateLoadStatus.call(controller, 'item1');
+ controller.updateLoadStatus('item1');
expect(controller.get('clusterDataLoadedPercent')).to.equal('width:50%');
});
it('when all items are loaded then isLoaded should be true', function () {
- controller.updateLoadStatus.call(controller, 'item2');
+ controller.updateLoadStatus('item2');
expect(controller.get('isLoaded')).to.equal(true);
});
it('when all items are loaded then width should be "width:100%"', function () {
- controller.updateLoadStatus.call(controller, 'item2');
+ controller.updateLoadStatus('item2');
expect(controller.get('clusterDataLoadedPercent')).to.equal('width:100%');
});
});
@@ -115,7 +115,7 @@ describe('App.clusterController', function () {
});
describe('#reloadSuccessCallback', function () {
- var test_data = {
+ var testData = {
"items": [
{
"Clusters": {
@@ -126,7 +126,7 @@ describe('App.clusterController', function () {
]
};
it('Check cluster', function () {
- controller.reloadSuccessCallback(test_data);
+ controller.reloadSuccessCallback(testData);
expect(App.get('clusterName')).to.equal('tdk');
expect(App.get('currentStackVersion')).to.equal('HDP-1.3.0');
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/controllers/global/update_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/global/update_controller_test.js b/ambari-web/test/controllers/global/update_controller_test.js
index 6a95871..25b2c5b 100644
--- a/ambari-web/test/controllers/global/update_controller_test.js
+++ b/ambari-web/test/controllers/global/update_controller_test.js
@@ -195,7 +195,7 @@ describe('App.UpdateController', function () {
});
testCases.forEach(function (test) {
it(test.title, function () {
- App.cache['services'] = test.services;
+ App.cache.services = test.services;
this.mock.withArgs('router.clusterController.isServiceMetricsLoaded').returns(true);
expect(controller.getConditionalFields()).to.eql(test.result);
});
@@ -203,7 +203,7 @@ describe('App.UpdateController', function () {
testCasesByStackVersion.forEach(function (test) {
it(test.title, function () {
- App.cache['services'] = test.services;
+ App.cache.services = test.services;
this.mock.withArgs('currentStackVersionNumber').returns(test.stackVersionNumber);
this.mock.withArgs('router.clusterController.isServiceMetricsLoaded').returns(true);
expect(controller.getConditionalFields()).to.eql(test.result);
@@ -211,7 +211,7 @@ describe('App.UpdateController', function () {
});
it('FLUME service, first load', function () {
- App.cache['services'] = [
+ App.cache.services = [
{
ServiceInfo: {
service_name: 'FLUME'
@@ -410,7 +410,6 @@ describe('App.UpdateController', function () {
};
}
},
- mainAdminStackAndUpgradeController = App.get('router.mainAdminStackAndUpgradeController'),
appGetMock;
beforeEach(function () {
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/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 65b19ab..cd75ed7 100644
--- a/ambari-web/test/controllers/installer_test.js
+++ b/ambari-web/test/controllers/installer_test.js
@@ -194,6 +194,7 @@ describe('App.InstallerController', function () {
])
})
]);
+ var resolve = false;
var data = {
osId: 1,
repoId: 11,
@@ -203,7 +204,6 @@ describe('App.InstallerController', function () {
}
}
};
- var resolve = false;
it ('Should check stacks for sucess', function() {
installerController.set('content.stacks', stacks);
@@ -277,6 +277,7 @@ describe('App.InstallerController', function () {
])
})
]);
+ var resolve = false;
var data = {
osId: 1,
repoId: 11,
@@ -286,7 +287,6 @@ describe('App.InstallerController', function () {
}
}
};
- var resolve = false;
it ('Should check stacks for error', function() {
var req = {
@@ -962,7 +962,7 @@ describe('App.InstallerController', function () {
describe('#loadMasterComponentHosts', function() {
beforeEach(function () {
- sinon.stub(installerController, 'getDBProperties', function(key) {
+ sinon.stub(installerController, 'getDBProperties', function() {
return {
masterComponentHosts: Em.A([
{
@@ -1226,7 +1226,7 @@ describe('App.InstallerController', function () {
var successCallback;
- beforeEach(function () {
+ beforeEach(function () {
sinon.stub(App.Stack, 'find').returns(test.stacks);
sinon.stub(App.router, 'get').withArgs('clusterController.isCustomJDK').returns(test.isCustomJDK)
.withArgs('clusterController.ambariProperties').returns(test.ambariProperties);
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/controllers/main/admin/highAvailability/nameNode/step3_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/admin/highAvailability/nameNode/step3_controller_test.js b/ambari-web/test/controllers/main/admin/highAvailability/nameNode/step3_controller_test.js
index 1b0fe31..938b2c9 100644
--- a/ambari-web/test/controllers/main/admin/highAvailability/nameNode/step3_controller_test.js
+++ b/ambari-web/test/controllers/main/admin/highAvailability/nameNode/step3_controller_test.js
@@ -189,12 +189,12 @@ describe('App.HighAvailabilityWizardStep3Controller', function() {
tests.forEach(function(test) {
it(test.m, function() {
- var controller = App.HighAvailabilityWizardStep3Controller.create({
+ var _controller = App.HighAvailabilityWizardStep3Controller.create({
configsToRemove: test.toRemove,
serverConfigData: test.configs
});
- var result = controller.removeConfigs(test.toRemove, controller.get('serverConfigData'));
- expect(JSON.stringify(controller.get('serverConfigData'))).to.equal(JSON.stringify(test.expected));
+ var result = _controller.removeConfigs(test.toRemove, _controller.get('serverConfigData'));
+ expect(JSON.stringify(_controller.get('serverConfigData'))).to.equal(JSON.stringify(test.expected));
expect(JSON.stringify(result)).to.equal(JSON.stringify(test.expected));
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/controllers/main/admin/kerberos/step2_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/admin/kerberos/step2_controller_test.js b/ambari-web/test/controllers/main/admin/kerberos/step2_controller_test.js
index 275588d..4cfa51c 100644
--- a/ambari-web/test/controllers/main/admin/kerberos/step2_controller_test.js
+++ b/ambari-web/test/controllers/main/admin/kerberos/step2_controller_test.js
@@ -54,11 +54,10 @@ describe('App.KerberosWizardStep2Controller', function() {
$.extend(true, {}, preDefProp, {
value: value, filename: 'some-site.xml',
'displayType': displayType,
- isRequiredByAgent: preDefProp.isRequiredByAgent == undefined ? true : preDefProp.isRequiredByAgent
+ isRequiredByAgent: preDefProp.isRequiredByAgent === undefined ? true : preDefProp.isRequiredByAgent
}));
- } else {
- return App.ServiceConfigProperty.create({name: name, value: value, isRequiredByAgent: true, filename: 'some-site.xml'});
}
+ return App.ServiceConfigProperty.create({name: name, value: value, isRequiredByAgent: true, filename: 'some-site.xml'});
};
var tests = [
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/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 3f284f4..1174f0a 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
@@ -17,7 +17,7 @@
*/
var App = require('app');
-var c = App.KerberosWizardStep4Controller.create({
+var c = App.KerberosWizardStep4Controller.create({
wizardController: Em.Object.create({
name: ''
})
@@ -57,38 +57,6 @@ describe('App.KerberosWizardStep4Controller', function() {
describe('#prepareConfigProperties', function() {
- before(function() {
- var controller = App.KerberosWizardStep4Controller.create({
- wizardController: {
- getDBProperty: function() {
- return Em.A([
- Em.Object.create({ name: 'realm', value: 'realm_value' })
- ]);
- },
- loadCachedStepConfigValues: function() {
- return null;
- }
- }
- });
- sinon.stub(App.Service, 'find').returns(Em.A([
- { serviceName: 'HDFS' }
- ]));
- sinon.stub(App.configsCollection, 'getAll').returns([
- {
- name: 'hadoop.security.auth_to_local',
- displayType: 'multiLine'
- }
- ]);
- sinon.stub(App.router, 'get').withArgs('mainAdminKerberosController.isManualKerberos').returns(false);
- this.result = controller.prepareConfigProperties(properties);
- });
-
- after(function() {
- App.Service.find.restore();
- App.configsCollection.getAll.restore();
- App.router.get.restore();
- });
-
var properties = Em.A([
Em.Object.create({ name: 'realm', value: '', serviceName: 'Cluster' }),
Em.Object.create({ name: 'spnego_keytab', value: 'spnego_keytab_value', serviceName: 'Cluster' }),
@@ -98,7 +66,7 @@ describe('App.KerberosWizardStep4Controller', function() {
Em.Object.create({ name: 'hdfs_principal', value: 'hdfs_principal_value', identityType: 'user', serviceName: 'HDFS' }),
Em.Object.create({ name: 'hadoop.security.auth_to_local', serviceName: 'HDFS' })
]);
-
+
var propertyValidationCases = [
{
property: 'spnego_keytab',
@@ -129,9 +97,41 @@ describe('App.KerberosWizardStep4Controller', function() {
]
}
];
-
+
var absentPropertiesTest = ['falcon_keytab', 'mapreduce_keytab'];
-
+
+ before(function() {
+ var controller = App.KerberosWizardStep4Controller.create({
+ wizardController: {
+ getDBProperty: function() {
+ return Em.A([
+ Em.Object.create({ name: 'realm', value: 'realm_value' })
+ ]);
+ },
+ loadCachedStepConfigValues: function() {
+ return null;
+ }
+ }
+ });
+ sinon.stub(App.Service, 'find').returns(Em.A([
+ { serviceName: 'HDFS' }
+ ]));
+ sinon.stub(App.configsCollection, 'getAll').returns([
+ {
+ name: 'hadoop.security.auth_to_local',
+ displayType: 'multiLine'
+ }
+ ]);
+ sinon.stub(App.router, 'get').withArgs('mainAdminKerberosController.isManualKerberos').returns(false);
+ this.result = controller.prepareConfigProperties(properties);
+ });
+
+ after(function() {
+ App.Service.find.restore();
+ App.configsCollection.getAll.restore();
+ App.router.get.restore();
+ });
+
it('should contains properties only for installed services', function() {
expect(this.result.mapProperty('serviceName').uniq()).to.be.eql(['Cluster', 'HDFS']);
});
@@ -160,6 +160,24 @@ describe('App.KerberosWizardStep4Controller', function() {
describe('#setStepConfigs', function() {
describe('Add Service Wizard', function() {
+
+ var properties = Em.A([
+ Em.Object.create({ name: 'realm', value: '', serviceName: 'Cluster' }),
+ Em.Object.create({ name: 'spnego_keytab', value: 'spnego_keytab_value', serviceName: 'Cluster', isEditable: true }),
+ Em.Object.create({ name: 'hdfs_keytab', value: '', serviceName: 'HDFS', observesValueFrom: 'spnego_keytab', isEditable: true }),
+ Em.Object.create({ name: 'falcon_keytab', value: 'falcon_keytab_value', serviceName: 'FALCON', isEditable: true }),
+ Em.Object.create({ name: 'mapreduce_keytab', value: 'mapreduce_keytab_value', serviceName: 'MAPREDUCE2', isEditable: true })
+ ]);
+
+ var propertiesEditableTests = [
+ { name: 'spnego_keytab', e: false },
+ { name: 'falcon_keytab', e: true },
+ { name: 'hdfs_keytab', e: false },
+ { name: 'mapreduce_keytab', e: true },
+ { name: 'admin_principal', e: true },
+ { name: 'admin_password', e: true }
+ ];
+
var res;
var controller;
before(function() {
@@ -204,23 +222,6 @@ describe('App.KerberosWizardStep4Controller', function() {
res = controller.get('stepConfigs')[0].get('configs').concat(controller.get('stepConfigs')[1].get('configs'));
});
- var properties = Em.A([
- Em.Object.create({ name: 'realm', value: '', serviceName: 'Cluster' }),
- Em.Object.create({ name: 'spnego_keytab', value: 'spnego_keytab_value', serviceName: 'Cluster', isEditable: true }),
- Em.Object.create({ name: 'hdfs_keytab', value: '', serviceName: 'HDFS', observesValueFrom: 'spnego_keytab', isEditable: true }),
- Em.Object.create({ name: 'falcon_keytab', value: 'falcon_keytab_value', serviceName: 'FALCON', isEditable: true }),
- Em.Object.create({ name: 'mapreduce_keytab', value: 'mapreduce_keytab_value', serviceName: 'MAPREDUCE2', isEditable: true })
- ]);
-
- var propertiesEditableTests = [
- { name: 'spnego_keytab', e: false },
- { name: 'falcon_keytab', e: true },
- { name: 'hdfs_keytab', e: false },
- { name: 'mapreduce_keytab', e: true },
- { name: 'admin_principal', e: true },
- { name: 'admin_password', e: true }
- ];
-
propertiesEditableTests.forEach(function(test) {
it('Add Service: property `{0}` should be {1} editable'.format(test.name, !!test.e ? '' : 'not '), function() {
expect(res.findProperty('name', test.name).get('isEditable')).to.eql(test.e);
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/controllers/main/admin/kerberos_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/admin/kerberos_test.js b/ambari-web/test/controllers/main/admin/kerberos_test.js
index d69e168..fa23082 100644
--- a/ambari-web/test/controllers/main/admin/kerberos_test.js
+++ b/ambari-web/test/controllers/main/admin/kerberos_test.js
@@ -98,7 +98,7 @@ describe('App.MainAdminKerberosController', function() {
controller.startKerberosWizard.restore();
});
it("shows popup", function () {
- var check = { items: [{
+ var check = { items: [{
UpgradeChecks: {
"check": "Work-preserving RM/NM restart is enabled in YARN configs",
"status": "FAIL",
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/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 23652ed..045b0f1 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
@@ -466,7 +466,7 @@ describe('App.MainAdminStackAndUpgradeController', function() {
);
expect(controller.upgrade.callCount).to.equal(item.upgradeCalledCount);
expect(App.showClusterCheckPopup.callCount).to.equal(item.showClusterCheckPopupCalledCount);
- if (item.check.id == 'CONFIG_MERGE') {
+ if (item.check.id === 'CONFIG_MERGE') {
expect(App.showClusterCheckPopup.firstCall.args[2]).to.eql(item.configs);
}
});
@@ -2125,6 +2125,7 @@ describe('App.MainAdminStackAndUpgradeController', function() {
});
it('new window content is valid', function () {
+ /*eslint-disable no-useless-concat */
expect(mock.document.write.calledWith('<table style="text-align: left;"><thead><tr>' +
'<th>' + Em.I18n.t('popup.clusterCheck.Upgrade.configsMerge.configType') + '</th>' +
'<th>' + Em.I18n.t('popup.clusterCheck.Upgrade.configsMerge.propertyName') + '</th>' +
@@ -2146,6 +2147,7 @@ describe('App.MainAdminStackAndUpgradeController', function() {
'<td>' + 'recommendedValue2' + '</td>' +
'<td>' + 'resultingValue2' + '</td>' +
'</tr></tbody></table>')).to.be.true;
+ /*eslint-enable no-useless-concat */
});
it('document.focus is called once', function () {
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/controllers/main/alerts/definitions_details_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/alerts/definitions_details_controller_test.js b/ambari-web/test/controllers/main/alerts/definitions_details_controller_test.js
index 2eb91c8..28e1829 100644
--- a/ambari-web/test/controllers/main/alerts/definitions_details_controller_test.js
+++ b/ambari-web/test/controllers/main/alerts/definitions_details_controller_test.js
@@ -39,13 +39,7 @@ describe('App.MainAlertDefinitionDetailsController', function () {
App.TestAliases.testAsComputedOr(getController(), 'isEditing', ['editing.label.isEditing', 'App.router.mainAlertDefinitionConfigsController.canEdit']);
describe('#showSavePopup', function () {
- var popup;
- beforeEach(function () {
- popup = getController().showSavePopup();
- });
-
App.TestAliases.testAsComputedOr(getController().showSavePopup(), 'disablePrimary', ['App.router.mainAlertDefinitionDetailsController.editing.label.isError', 'App.router.mainAlertDefinitionConfigsController.hasErrors']);
-
});
describe('#labelValidation()', function () {
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/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 025ce86..9352116 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
@@ -942,13 +942,13 @@ describe('App.ManageAlertNotificationsController', function () {
controller.set('inputFields.customProperties', []);
});
+ /*eslint-disable mocha-cleanup/asserts-limit */
it('should add custom Property to customProperties', function () {
-
controller.set('newCustomProperty', {name: 'n1', value: 'v1'});
controller.addCustomProperty();
helpers.nestedExpect([{name: 'n1', value: 'v1', defaultValue: 'v1'}], controller.get('inputFields.customProperties'));
-
});
+ /*eslint-enable mocha-cleanup/asserts-limit */
});
@@ -964,8 +964,8 @@ describe('App.ManageAlertNotificationsController', function () {
]);
});
+ /*eslint-disable mocha-cleanup/asserts-limit */
it('should remove selected custom property', function () {
-
controller.removeCustomPropertyHandler({context: c});
helpers.nestedExpect(
[
@@ -974,8 +974,8 @@ describe('App.ManageAlertNotificationsController', function () {
],
controller.get('inputFields.customProperties')
);
-
});
+ /*eslint-enable mocha-cleanup/asserts-limit */
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/controllers/main/charts/heatmap_metrics/heatmap_metric_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/charts/heatmap_metrics/heatmap_metric_test.js b/ambari-web/test/controllers/main/charts/heatmap_metrics/heatmap_metric_test.js
index 8d724d2..660e767 100644
--- a/ambari-web/test/controllers/main/charts/heatmap_metrics/heatmap_metric_test.js
+++ b/ambari-web/test/controllers/main/charts/heatmap_metrics/heatmap_metric_test.js
@@ -38,7 +38,7 @@ describe('MainChartHeatmapMetric', function () {
expect(mainChartHeatmapMetric.formatLegendNumber(test.i)).to.equal(test.e);
});
});
- it('NaN to NaN' + ' ', function () {
+ it('NaN to NaN', function () {
expect(isNaN(mainChartHeatmapMetric.formatLegendNumber(NaN))).to.equal(true);
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/controllers/main/charts/heatmap_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/charts/heatmap_test.js b/ambari-web/test/controllers/main/charts/heatmap_test.js
index ec87ace..c3e70e8 100644
--- a/ambari-web/test/controllers/main/charts/heatmap_test.js
+++ b/ambari-web/test/controllers/main/charts/heatmap_test.js
@@ -366,9 +366,9 @@ describe('MainChartsHeatmapController', function () {
{rack: 'r1'}
];
var rackMap = controller.indexByRackId(hosts);
- expect(rackMap['r1'].name).to.equal('r1');
- expect(rackMap['r1'].rackId).to.equal('r1');
- expect(rackMap['r1'].hosts).to.eql([{rack: 'r1'}, {rack: 'r1'}]);
+ expect(rackMap.r1.name).to.equal('r1');
+ expect(rackMap.r1.rackId).to.equal('r1');
+ expect(rackMap.r1.hosts).to.eql([{rack: 'r1'}, {rack: 'r1'}]);
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/controllers/main/host/details_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/host/details_test.js b/ambari-web/test/controllers/main/host/details_test.js
index f4f0b33..a108c8d 100644
--- a/ambari-web/test/controllers/main/host/details_test.js
+++ b/ambari-web/test/controllers/main/host/details_test.js
@@ -827,10 +827,7 @@ describe('App.MainHostDetailsController', function () {
describe('#showAddComponentPopup()', function () {
- var message = 'Comp1',
- component = Em.Object.create({
- componentName: ' Comp1'
- });
+ var message = 'Comp1';
beforeEach(function () {
sinon.spy(App.ModalPopup, 'show');
@@ -857,7 +854,6 @@ describe('App.MainHostDetailsController', function () {
});
it('data is null', function () {
- var data = {Requests: null};
expect(controller.installNewComponentSuccessCallback(null, {}, {})).to.be.false;
expect(controller.showBackgroundOperationsPopup.called).to.be.false;
});
@@ -2152,7 +2148,7 @@ describe('App.MainHostDetailsController', function () {
this.stub = sinon.stub(App.HostComponent, 'find').returns([{
id: 'TASKTRACKER_host1',
componentName: 'TASKTRACKER'
- }]);;
+ }]);
});
afterEach(function () {
@@ -3065,7 +3061,7 @@ describe('App.MainHostDetailsController', function () {
describe(item.title, function () {
beforeEach(function () {
- sinon.stub(controller, 'checkComponentDependencies', function (componentName, params) {
+ sinon.stub(controller, 'checkComponentDependencies', function (componentName) {
return item.dependencies[componentName];
});
controller.installClients({
@@ -3578,7 +3574,7 @@ describe('App.MainHostDetailsController', function () {
describe("#removeHostComponentModel()", function () {
beforeEach(function () {
- App.cache['services'] = [
+ App.cache.services = [
{
ServiceInfo: {
service_name: 'S1'
@@ -3604,7 +3600,7 @@ describe('App.MainHostDetailsController', function () {
App.serviceMapper.deleteRecord.restore();
});
it("App.cache is updated", function () {
- expect(App.cache['services'][0].host_components).to.be.empty;
+ expect(App.cache.services[0].host_components).to.be.empty;
});
it('Record is deleted', function () {
expect(App.serviceMapper.deleteRecord.calledOnce).to.be.true;
@@ -3823,8 +3819,8 @@ describe('App.MainHostDetailsController', function () {
var makeHostComponentModel = function(componentName, hostNames) {
if (Em.isArray(componentName)) {
- return componentName.map(function(componentName, index) {
- return makeHostComponentModel(componentName, hostNames[index]);
+ return componentName.map(function(cName, index) {
+ return makeHostComponentModel(cName, hostNames[index]);
}).reduce(function(p,c) { return p.concat(c); }, []);
}
return hostNames.map(function(hostName) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/controllers/main/host_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/host_test.js b/ambari-web/test/controllers/main/host_test.js
index 59ca14b..386434b 100644
--- a/ambari-web/test/controllers/main/host_test.js
+++ b/ambari-web/test/controllers/main/host_test.js
@@ -17,7 +17,6 @@
*/
var App = require('app');
-var validator = require('utils/validator');
require('utils/batch_scheduled_requests');
require('controllers/main/host');
require('mappers/server_data_mapper');
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/controllers/main/service/add_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/add_controller_test.js b/ambari-web/test/controllers/main/service/add_controller_test.js
index 601d7d8..3c7639c 100644
--- a/ambari-web/test/controllers/main/service/add_controller_test.js
+++ b/ambari-web/test/controllers/main/service/add_controller_test.js
@@ -381,7 +381,7 @@ describe('App.AddServiceController', function() {
sinon.stub(this.controller, 'setDBProperty', function(key, value) {
mock.db = value;
});
- this.mockStackService = sinon.stub(App.StackService, 'find');
+ this.mockStackService = sinon.stub(App.StackService, 'find');
this.mockService = sinon.stub(App.Service, 'find');
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/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 60aa8d6..9ebd914 100644
--- a/ambari-web/test/controllers/main/service/info/config_test.js
+++ b/ambari-web/test/controllers/main/service/info/config_test.js
@@ -127,7 +127,7 @@ describe("App.MainServiceInfoConfigsController", function () {
passwordConfigsAreChanged: false
});
sinon.stub(mainServiceInfoConfigsController, "get", function(key) {
- return key == 'isSubmitDisabled' ? false : Em.get(mainServiceInfoConfigsController, key);
+ return key === 'isSubmitDisabled' ? false : Em.get(mainServiceInfoConfigsController, key);
});
sinon.stub(mainServiceInfoConfigsController, "restartServicePopup", Em.K);
sinon.stub(mainServiceInfoConfigsController, "getHash", function () {
@@ -340,7 +340,7 @@ describe("App.MainServiceInfoConfigsController", function () {
mainServiceInfoConfigsController.set("content.displayName", t.displayName);
mainServiceInfoConfigsController.set("content.passiveState", t.passiveState);
mainServiceInfoConfigsController.rollingRestartStaleConfigSlaveComponents(t.componentName);
- expect(batchUtils.launchHostComponentRollingRestart.calledWith(t.componentName.context, t.displayName, t.passiveState == "ON", true)).to.equal(true);
+ expect(batchUtils.launchHostComponentRollingRestart.calledWith(t.componentName.context, t.displayName, t.passiveState === "ON", true)).to.equal(true);
});
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/controllers/main/service/info/summary_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/info/summary_test.js b/ambari-web/test/controllers/main/service/info/summary_test.js
index 3db7239..868cf67 100644
--- a/ambari-web/test/controllers/main/service/info/summary_test.js
+++ b/ambari-web/test/controllers/main/service/info/summary_test.js
@@ -288,11 +288,11 @@ App.TestAliases.testAsComputedOr(getController(), 'showTimeRangeControl', ['!isS
App.ajax.send.restore();
});
it("make GET call", function () {
- var controller = App.MainServiceInfoSummaryController.create({
+ var _controller = App.MainServiceInfoSummaryController.create({
isServiceWithEnhancedWidgets: true,
content: Em.Object.create({serviceName: 'HDFS'})
});
- controller.getActiveWidgetLayout();
+ _controller.getActiveWidgetLayout();
expect(App.ajax.send.getCall(0).args[0].name).to.equal('widgets.layouts.active.get');
});
});
@@ -307,14 +307,14 @@ App.TestAliases.testAsComputedOr(getController(), 'showTimeRangeControl', ['!isS
App.widgetMapper.map.restore();
});
it("isWidgetLayoutsLoaded should be set to true", function () {
- var controller = App.MainServiceInfoSummaryController.create({
+ var _controller = App.MainServiceInfoSummaryController.create({
isServiceWithEnhancedWidgets: true,
content: Em.Object.create({serviceName: 'HDFS'})
});
- controller.getActiveWidgetLayoutSuccessCallback({items:[{
+ _controller.getActiveWidgetLayoutSuccessCallback({items:[{
WidgetLayoutInfo: {}
}]});
- expect(controller.get('isWidgetsLoaded')).to.be.true;
+ expect(_controller.get('isWidgetsLoaded')).to.be.true;
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/controllers/main/service/item_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/item_test.js b/ambari-web/test/controllers/main/service/item_test.js
index 8b2f24e..7b75dbb 100644
--- a/ambari-web/test/controllers/main/service/item_test.js
+++ b/ambari-web/test/controllers/main/service/item_test.js
@@ -251,88 +251,6 @@ describe('App.MainServiceItemController', function () {
});
});
- describe("#startStopPopupPrimary", function () {
-
- var mainServiceItemController;
- var tests = [
- {
- data: {
- "serviceName": "HDFS",
- "state": "STARTED",
- "query": Em.Object.create({ServiceInfo: "FAIL"})
- },
- request: {
- "RequestInfo": {
- "context": "_PARSE_.START.HDFS"
- },
- "Body": {
- "ServiceInfo": {
- "state": "STARTED"
- }
- }
- },
- m: "Start HDFS"
- },
- {
- data: {
- "serviceName": "YARN",
- "state": "STOPPED",
- "query": Em.Object.create({ServiceInfo: "FAIL"})
- },
- request: {
- "RequestInfo": {
- "context": "_PARSE_.STOP.YARN"
- },
- "Body": {
- "ServiceInfo": {
- "state": "STOPPED"
- }
- }
- },
- m: "Stop YARN"
- }
- ];
-
- beforeEach(function () {
- sinon.spy($, 'ajax');
- });
-
- afterEach(function () {
- $.ajax.restore();
- });
-
-
- tests.forEach(function (test, index) {
-
- describe('case #' + (index + 1), function () {
-
- beforeEach(function () {
- mainServiceItemController = App.MainServiceItemController.create({content: {serviceName: test.data.serviceName}});
- mainServiceItemController.startStopPopupPrimary(test.data.state, test.data.query);
- this.data = JSON.parse($.ajax.args[0][0].data);
- });
-
- it('request is sent with valid data ' + (index + 1), function () {
- expect($.ajax.calledOnce).to.equal(true);
- expect(this.data.Body.ServiceInfo.state).to.equal(test.request.Body.ServiceInfo.state);
- expect(this.data.RequestInfo.context).to.equal(test.request.RequestInfo.context);
- });
-
- it('isStopDisabled is true ' + (index + 1), function () {
- expect(mainServiceItemController.get('isStopDisabled')).to.equal(true);
- });
-
- it('isStartDisabled is true ' + (index + 1), function () {
- expect(mainServiceItemController.get('isStartDisabled')).to.equal(true);
- });
-
- });
-
- });
-
-
- });
-
describe("#startService , #stopService", function () {
var mainServiceItemController = App.MainServiceItemController.create({startStopPopup: Em.K});
beforeEach(function () {
@@ -516,16 +434,15 @@ describe('App.MainServiceItemController', function () {
});
it ("should not display a dependent list if it is to start a service", function() {
- var mainServiceItemController = App.MainServiceItemController.create(
+ var _mainServiceItemController = App.MainServiceItemController.create(
{content: {serviceName: "HDFS", passiveState:'OFF'}});
- mainServiceItemController.startStopPopup(event, "");
+ _mainServiceItemController.startStopPopup(event, "");
expect(Em.I18n.t.calledWith('services.service.stop.warningMsg.dependent.services')).to.not.be.ok;
});
describe ("should display dependent list if other services depend on the one to be stopped", function() {
- var mainServiceItemController;
beforeEach(function () {
- mainServiceItemController = App.MainServiceItemController.create(
+ var _mainServiceItemController = App.MainServiceItemController.create(
{content: {
serviceName: "HDFS",
passiveState:'OFF',
@@ -535,10 +452,10 @@ describe('App.MainServiceItemController', function () {
}]
}}
);
- mainServiceItemController.startStopPopup(event, "INSTALLED");
+ _mainServiceItemController.startStopPopup(event, "INSTALLED");
this.dependencies = Em.I18n.t('services.service.stop.warningMsg.dependent.services').format("HDFS", "HBase,YARN");
this.msg = Em.I18n.t('services.service.stop.warningMsg.turnOnMM').format("HDFS");
- this.fullMsg = mainServiceItemController.addAdditionalWarningMessage("INSTALLED", this.msg, "HDFS");
+ this.fullMsg = _mainServiceItemController.addAdditionalWarningMessage("INSTALLED", this.msg, "HDFS");
});
it('turnOnMM message is shown', function () {
@@ -555,12 +472,12 @@ describe('App.MainServiceItemController', function () {
describe("should display the dependent service if another service depends on the one to be stopped", function() {
beforeEach(function () {
- var mainServiceItemController = App.MainServiceItemController.create(
+ var _mainServiceItemController = App.MainServiceItemController.create(
{content: {serviceName: "HIVE", passiveState:'OFF'}});
- mainServiceItemController.startStopPopup(event, "INSTALLED");
+ _mainServiceItemController.startStopPopup(event, "INSTALLED");
this.dependencies = Em.I18n.t('services.service.stop.warningMsg.dependent.services').format("HIVE", "Spark");
this.msg = Em.I18n.t('services.service.stop.warningMsg.turnOnMM').format("HIVE");
- this.fullMsg = mainServiceItemController.addAdditionalWarningMessage("INSTALLED", this.msg, "HIVE");
+ this.fullMsg = _mainServiceItemController.addAdditionalWarningMessage("INSTALLED", this.msg, "HIVE");
});
it('message about dependent services is shown', function () {
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/controllers/main/service/manage_config_groups_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/manage_config_groups_controller_test.js b/ambari-web/test/controllers/main/service/manage_config_groups_controller_test.js
index 0cc0f5f..119547f 100644
--- a/ambari-web/test/controllers/main/service/manage_config_groups_controller_test.js
+++ b/ambari-web/test/controllers/main/service/manage_config_groups_controller_test.js
@@ -194,7 +194,7 @@ describe('App.ManageConfigGroupsController', function() {
var service = Em.Object.create({});
manageConfigGroupsController.set('hostsModifiedConfigGroups', {});
describe("#controller passed", function () {
- var controller = Em.Object.create({
+ controller = Em.Object.create({
content: Em.Object.create()
});
var popup = manageConfigGroupsController.manageConfigurationGroups(controller, service);
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/controllers/main/service/reassign/step1_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/reassign/step1_controller_test.js b/ambari-web/test/controllers/main/service/reassign/step1_controller_test.js
index dee3251..f4a9714 100644
--- a/ambari-web/test/controllers/main/service/reassign/step1_controller_test.js
+++ b/ambari-web/test/controllers/main/service/reassign/step1_controller_test.js
@@ -92,7 +92,6 @@ describe('App.ReassignMasterWizardStep1Controller', function () {
describe('#onLoadConfigs', function() {
- var controller;
var reassignCtrl;
beforeEach(function() {
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/controllers/main/service/reassign/step2_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/reassign/step2_controller_test.js b/ambari-web/test/controllers/main/service/reassign/step2_controller_test.js
index 7521d93..4483f94 100644
--- a/ambari-web/test/controllers/main/service/reassign/step2_controller_test.js
+++ b/ambari-web/test/controllers/main/service/reassign/step2_controller_test.js
@@ -35,7 +35,6 @@ describe('App.ReassignMasterWizardStep2Controller', function () {
describe('#customClientSideValidation', function () {
var hostComponents = [];
- var isSubmitDisabled = false;
beforeEach(function () {
sinon.stub(App.HostComponent, 'find', function () {
@@ -89,8 +88,6 @@ describe('App.ReassignMasterWizardStep2Controller', function () {
});
it('submitDisabled is already true', function () {
- isSubmitDisabled = true;
-
expect(controller.customClientSideValidation()).to.be.false;
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/controllers/main/service/reassign/step4_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/reassign/step4_controller_test.js b/ambari-web/test/controllers/main/service/reassign/step4_controller_test.js
index 7ea47c6..11bcae7 100644
--- a/ambari-web/test/controllers/main/service/reassign/step4_controller_test.js
+++ b/ambari-web/test/controllers/main/service/reassign/step4_controller_test.js
@@ -549,7 +549,7 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
});
describe('#getConfigUrlParams()', function () {
- var testCases = [
+ var testCases = [
{
componentName: 'NAMENODE',
result: [
@@ -1577,7 +1577,7 @@ describe('App.ReassignMasterWizardStep4Controller', function () {
});
- describe("#prepareDBCheckAction()", function() {
+ describe.skip("#prepareDBCheckAction()", function() {
beforeEach(function () {
sinon.stub(App.router, 'get').returns({
'jdk_location': 'jdk_location',
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/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 e860660..70a160b 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
@@ -263,7 +263,7 @@ describe('App.WidgetWizardStep2Controller', function () {
});
it('check id', function () {
- expect(controller.get('expressions').mapProperty('id')).to.eql([1, 2]);;
+ expect(controller.get('expressions').mapProperty('id')).to.eql([1, 2]);
});
it('check isRemovable', function () {
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/controllers/main/service/widgets/create/wizard_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/widgets/create/wizard_controller_test.js b/ambari-web/test/controllers/main/service/widgets/create/wizard_controller_test.js
index 83ce39f..4733716 100644
--- a/ambari-web/test/controllers/main/service/widgets/create/wizard_controller_test.js
+++ b/ambari-web/test/controllers/main/service/widgets/create/wizard_controller_test.js
@@ -37,9 +37,11 @@ describe('App.WidgetWizardController', function () {
beforeEach(function () {
controller = App.WidgetWizardController.create();
sinon.stub(App.YARNService, 'find', function (k) {
- if ('YARN' === k) return Em.Object.create({
- 'allQueueNames': ["root", "root/queue1", "root/queue1/queue2", "root/queue1/queue3"]
- });
+ if ('YARN' === k) {
+ return Em.Object.create({
+ 'allQueueNames': ["root", "root/queue1", "root/queue1/queue2", "root/queue1/queue3"]
+ });
+ }
});
});
afterEach(function () {
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/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 f9e6e8b..0e7f464 100644
--- a/ambari-web/test/controllers/main/service_test.js
+++ b/ambari-web/test/controllers/main/service_test.js
@@ -110,7 +110,7 @@ describe('App.MainServiceController', function () {
describe('#cluster', function() {
- var tests = Em.A([
+ Em.A([
{
isLoaded: true,
cluster: [],
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/controllers/main_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main_test.js b/ambari-web/test/controllers/main_test.js
index 2a4fe97..0061695 100644
--- a/ambari-web/test/controllers/main_test.js
+++ b/ambari-web/test/controllers/main_test.js
@@ -111,7 +111,6 @@ describe('App.MainController', function () {
});
describe('#checkServerClientVersion', function() {
- var initialize = false;
beforeEach(function () {
sinon.stub(mainController, 'getServerVersion').returns({
done: function(func) {
@@ -156,14 +155,14 @@ describe('App.MainController', function () {
});
});
- describe('#updateTitle', function() {
+ describe.skip('#updateTitle', function() {
beforeEach(function () {
sinon.stub(App.router, 'get', function(message){
- if (message == 'clusterController.clusterName') {
+ if (message === 'clusterController.clusterName') {
return 'c1';
- } else if (message == 'clusterInstallCompleted') {
+ } else if (message === 'clusterInstallCompleted') {
return true;
- } else if (message == 'clusterController') {
+ } else if (message === 'clusterController') {
return {
get: function() {
return true;
@@ -175,7 +174,7 @@ describe('App.MainController', function () {
afterEach(function () {
App.router.get.restore();
});
- it ('Should update title', function() {
+ it('Should update title', function() {
$('body').append('<title id="title-id">text</title>');
mainController.updateTitle();
expect($('title').text()).to.be.equal('Ambari - c1');
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/controllers/wizard/step10_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step10_test.js b/ambari-web/test/controllers/wizard/step10_test.js
index 92743c3..1d9244c 100644
--- a/ambari-web/test/controllers/wizard/step10_test.js
+++ b/ambari-web/test/controllers/wizard/step10_test.js
@@ -410,7 +410,7 @@ describe('App.WizardStep10Controller', function () {
tests.forEach(function(test) {
it('Install time' + test.installTime ? ' available' : ' not available', function() {
controller.set('content', {cluster: {installTime: test.installTime}});
- var r = controller.loadInstallTime();
+ controller.loadInstallTime();
expect(controller.get('clusterInfo').mapProperty('id')).to.eql(test.e);
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/controllers/wizard/step2_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step2_test.js b/ambari-web/test/controllers/wizard/step2_test.js
index 843e4c2..1a67ca9 100644
--- a/ambari-web/test/controllers/wizard/step2_test.js
+++ b/ambari-web/test/controllers/wizard/step2_test.js
@@ -17,7 +17,6 @@
*/
var App = require('app');
-var Ember = require('ember');
require('controllers/wizard/step2_controller');
require('models/host');
require('models/host_component');
@@ -412,7 +411,7 @@ describe('App.WizardStep2Controller', function () {
var result = true;
var hosts = controller.get('hostNameArr');
for (var i = 1; i<12; i++) {
- var extra = (i.toString().length == 1) ? 0 : '';
+ var extra = i.toString().length === 1 ? 0 : '';
if (hosts[i-1] !== 'host0' + extra + i) {
result = false;
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/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 ca710f3..7b6684f 100644
--- a/ambari-web/test/controllers/wizard/step3_test.js
+++ b/ambari-web/test/controllers/wizard/step3_test.js
@@ -73,7 +73,7 @@ describe('App.WizardStep3Controller', function () {
Em.Object.create({name: 'wst3_host2'})
]
});
- var test_data = {
+ var testData = {
items: [
{
Hosts: {
@@ -92,7 +92,7 @@ describe('App.WizardStep3Controller', function () {
}
]
};
- c.getAllRegisteredHostsCallback(test_data);
+ c.getAllRegisteredHostsCallback(testData);
expect(c.get('hasMoreRegisteredHosts')).to.equal(true);
expect(c.get('registeredHosts').length).to.equal(1);
});
@@ -107,7 +107,7 @@ describe('App.WizardStep3Controller', function () {
{name: 'wst3_host4'}
]
});
- var test_data = {
+ var testData = {
items: [
{
Hosts: {
@@ -121,7 +121,7 @@ describe('App.WizardStep3Controller', function () {
}
]
};
- c.getAllRegisteredHostsCallback(test_data);
+ c.getAllRegisteredHostsCallback(testData);
expect(c.get('hasMoreRegisteredHosts')).to.equal(false);
expect(c.get('registeredHosts')).to.equal('');
});
@@ -135,7 +135,7 @@ describe('App.WizardStep3Controller', function () {
{name: 'wst3_host1'}
]
});
- var test_data = {
+ var testData = {
items: [
{
Hosts: {
@@ -144,7 +144,7 @@ describe('App.WizardStep3Controller', function () {
}
]
};
- c.getAllRegisteredHostsCallback(test_data);
+ c.getAllRegisteredHostsCallback(testData);
expect(c.get('hasMoreRegisteredHosts')).to.equal(false);
expect(c.get('registeredHosts')).to.equal('');
});
@@ -2738,8 +2738,7 @@ describe('App.WizardStep3Controller', function () {
it('should do request to ambari-server', function () {
var data = null,
- jdkRequestIndex = 'jdkRequestIndex',
- url = '/requests/' + jdkRequestIndex + '?fields=*,tasks/Tasks/host_name,tasks/Tasks/status,tasks/Tasks/structured_out';
+ jdkRequestIndex = 'jdkRequestIndex';
c.set('jdkRequestIndex', jdkRequestIndex);
c.set('jdkCategoryWarnings', null);
c.doCheckJDKsuccessCallback(data);
@@ -2751,11 +2750,9 @@ describe('App.WizardStep3Controller', function () {
describe('#doCheckJDKerrorCallback', function () {
it('should set isJDKWarningsLoaded to true', function () {
-
c.set('isJDKWarningsLoaded', false);
c.doCheckJDKerrorCallback();
- c.set('isJDKWarningsLoaded', true);
-
+ expect(c.get('isJDKWarningsLoaded')).to.be.true;
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/controllers/wizard/step4_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step4_test.js b/ambari-web/test/controllers/wizard/step4_test.js
index b6b99bb..9227279 100644
--- a/ambari-web/test/controllers/wizard/step4_test.js
+++ b/ambari-web/test/controllers/wizard/step4_test.js
@@ -40,7 +40,7 @@ describe('App.WizardStep4Controller', function () {
'isSelected': false,
'canBeSelected': true,
'isInstalled': false,
- isPrimaryDFS: serviceName == 'HDFS',
+ isPrimaryDFS: serviceName === 'HDFS',
isDFS: ['HDFS','GLUSTERFS'].contains(serviceName),
isMonitoringService: ['GANGLIA'].contains(serviceName),
requiredServices: App.StackService.find(serviceName).get('requiredServices'),
@@ -58,7 +58,7 @@ describe('App.WizardStep4Controller', function () {
return allServices;
};
- services.forEach(function(serviceName, index){
+ services.forEach(function(serviceName) {
controller.pushObject(Ember.Object.create({
'serviceName':serviceName, 'isSelected': true, 'isHiddenOnSelectServicePage': false, 'isInstalled': false, 'isDisabled': 'HDFS' === serviceName, isDFS: 'HDFS' === serviceName
}));
@@ -164,22 +164,25 @@ describe('App.WizardStep4Controller', function () {
beforeEach(function () {
controller.clear();
- for(var id in testCase.condition) {
+ Object.keys(testCase.condition).forEach(function (id) {
controller.pushObject(Ember.Object.create({
- 'serviceName':id, 'isSelected': testCase.condition[id], 'canBeSelected': true, 'isInstalled': false,
+ serviceName: id,
+ isSelected: testCase.condition[id],
+ canBeSelected: true,
+ isInstalled: false,
coSelectedServices: function() {
return App.StackService.coSelected[this.get('serviceName')] || [];
}.property('serviceName')
}));
- }
+ });
controller.setGroupedServices();
});
- for(var service in testCase.result) {
+ Object.keys(testCase.result).forEach(function (service) {
it(service, function () {
expect(controller.findProperty('serviceName', service).get('isSelected')).to.equal(testCase.result[service]);
});
- }
+ });
});
}, this);
});
@@ -335,7 +338,7 @@ describe('App.WizardStep4Controller', function () {
controllerNames.forEach(function (name) {
tests.forEach(function(test) {
var errorsExpected = test.errorsExpected;
- if (name != 'installerController') {
+ if (name !== 'installerController') {
errorsExpected = test.errorsExpected.without('ambariMetricsCheck');
}
var message = '{0}, {1} selected validation should be {2}, errors: {3}'
@@ -442,7 +445,7 @@ describe('App.WizardStep4Controller', function () {
beforeEach(function () {
currentErrorObject = c.get('errorStack').findProperty('isShown', false);
});
- test.errorsExpected.forEach(function(error, index, errors) {
+ test.errorsExpected.forEach(function(error) {
it(error, function () {
// validate current error
if (currentErrorObject) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/controllers/wizard/step5_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step5_test.js b/ambari-web/test/controllers/wizard/step5_test.js
index 033b067..e0f8b71 100644
--- a/ambari-web/test/controllers/wizard/step5_test.js
+++ b/ambari-web/test/controllers/wizard/step5_test.js
@@ -16,7 +16,6 @@
* limitations under the License.
*/
-var Ember = require('ember');
var App = require('app');
require('controllers/wizard/step5_controller');
var modelSetup = require('test/init_model_test');
@@ -30,7 +29,6 @@ describe('App.WizardStep5Controller', function () {
var controller = App.WizardStep5Controller.create();
controller.set('content', {});
- var cpu = 2, memory = 4;
controller.set('content', {});
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/controllers/wizard/step6_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/wizard/step6_test.js b/ambari-web/test/controllers/wizard/step6_test.js
index e18d991..4fdd642 100644
--- a/ambari-web/test/controllers/wizard/step6_test.js
+++ b/ambari-web/test/controllers/wizard/step6_test.js
@@ -90,13 +90,13 @@ describe('App.WizardStep6Controller', function () {
describe('#installedServiceNames', function () {
it(' should filter content.services by isInstalled property', function () {
- var services = Em.A([]);
- services.pushObjects(Em.A([{isInstalled: true, serviceName: "service1"},
+ var _services = Em.A([]);
+ _services.pushObjects(Em.A([{isInstalled: true, serviceName: "service1"},
{isInstalled: false, serviceName: "service2"},
{isInstalled: true, serviceName: "service3"},
{isInstalled: false, serviceName: "service4"},
{isInstalled: true, serviceName: "service5"}]));
- controller.set('content.services', services);
+ controller.set('content.services', _services);
expect(controller.get('installedServiceNames')).to.eql(["service1", "service3", "service5"]);
});
});
@@ -588,7 +588,7 @@ describe('App.WizardStep6Controller', function () {
beforeEach(function () {
sinon.stub(validationUtils, 'filterNotInstalledComponents', function () {
- return Em.A([Em.Object.create({
+ return Em.A([Em.Object.create({
componentName: 'c0',
isSlave: true,
type: 'host-component',
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/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 a6a5fab..2d82cbc 100644
--- a/ambari-web/test/controllers/wizard/step7_test.js
+++ b/ambari-web/test/controllers/wizard/step7_test.js
@@ -262,7 +262,7 @@ describe('App.InstallerStep7Controller', function () {
describe('#_createSiteToTagMap', function () {
it('should return filtered map', function () {
- var desired_configs = {
+ var desiredConfigs = {
site1: {
tag: "tag1"
},
@@ -277,7 +277,7 @@ describe('App.InstallerStep7Controller', function () {
site1: true,
site3: true
};
- var siteToTagMap = installerStep7Controller._createSiteToTagMap(desired_configs,sites);
+ var siteToTagMap = installerStep7Controller._createSiteToTagMap(desiredConfigs,sites);
expect(siteToTagMap).to.eql({
site1: "tag1",
site3: "tag3"
@@ -363,7 +363,7 @@ describe('App.InstallerStep7Controller', function () {
});
it('should return serviceConfigTags', function () {
- var desired_configs = {
+ var desiredConfigs = {
site1: {
tag: "tag1"
},
@@ -376,10 +376,10 @@ describe('App.InstallerStep7Controller', function () {
};
var data = {
Clusters: {
- desired_configs: desired_configs
+ desired_configs: desiredConfigs
}
};
- var siteToTagMap = installerStep7Controller.getConfigTagsSuccess(data);
+ installerStep7Controller.getConfigTagsSuccess(data);
expect(installerStep7Controller.get('serviceConfigTags')).to.eql([
{
"siteName": "site1",
@@ -541,8 +541,7 @@ describe('App.InstallerStep7Controller', function () {
{isDefault: false, n: 'n1'},
defaultGroup,
{n: 'n3'}
- ],
- selectedConfigGroup = {};
+ ];
installerStep7Controller.reopen({selectedService: {serviceName: 's1', configGroups: configGroups}});
installerStep7Controller.selectedServiceObserver();
expect(installerStep7Controller.get('configGroups').mapProperty('n')).to.eql(['n2', 'n1', 'n3']);
@@ -1517,7 +1516,7 @@ describe('App.InstallerStep7Controller', function () {
});
installerStep7Controller.set('wizardController', wizardController);
installerStep7Controller.set('stepConfigs', Em.A([Em.Object.create({serviceName: 'OOZIE', configs: Em.A([]) })]));
- var desired_configs = {
+ var desiredConfigs = {
site1: {
tag: "tag1"
},
@@ -1543,7 +1542,7 @@ describe('App.InstallerStep7Controller', function () {
})
})]),
Clusters: {
- desired_configs: desired_configs
+ desired_configs: desiredConfigs
}
};
installerStep7Controller.loadServiceTagsSuccess(data, {}, params);
@@ -1687,14 +1686,16 @@ describe('App.InstallerStep7Controller', function () {
recommendedValue: 'c6402.ambari.apache.org:50070'
}
];
+ var oldConfigs = configs.slice();
it('should copy properties from hdfs-site to hdfs-client for HAWQ', function() {
- var oldConfigs = configs.slice();
installerStep7Controller.addHawqConfigsOnNnHa(configs);
// ensure 6 new configs were added
expect(configs.length - oldConfigs.length).to.be.eql(6);
- oldConfigs.forEach(function(property){
- // 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
+ });
+
+ 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 () {
+ oldConfigs.forEach(function(property) {
expect(configs.findProperty('id', property.name + '__hdfs-client').description).to.be.eql(property.description);
expect(configs.findProperty('id', property.name + '__hdfs-client').displayName).to.be.eql(property.displayName);
expect(configs.findProperty('id', property.name + '__hdfs-client').value).to.be.eql(property.value);
@@ -1719,26 +1720,32 @@ describe('App.InstallerStep7Controller', function () {
}
];
- it('should update properties in yarn-client for HAWQ if yarn ha is enabled', function() {
- var inputConfigsCount = configs.length;
+ beforeEach(function () {
+ this.inputConfigsCount = configs.length;
installerStep7Controller.addHawqConfigsOnRMHa(configs);
- var yarnRmDetails = configs.findProperty('id', 'yarn.resourcemanager.ha__yarn-client');
- var yarnRmSchedulerDetails = configs.findProperty('id', 'yarn.resourcemanager.scheduler.ha__yarn-client');
+ this.yarnRmDetails = configs.findProperty('id', 'yarn.resourcemanager.ha__yarn-client');
+ this.yarnRmSchedulerDetails = configs.findProperty('id', 'yarn.resourcemanager.scheduler.ha__yarn-client');
+ });
+ it('should update properties in yarn-client for HAWQ if yarn ha is enabled', function() {
+ var noOfConfigsAdded = 2;
+ expect(configs.length).to.be.equal(this.inputConfigsCount + noOfConfigsAdded);
+ });
+
+ it('yarn.resourcemanager.ha__yarn-client', function() {
var expectedYarnRmHaValue = 'c6401.ambari.apache.org:8032,c6402.ambari.apache.org:8032';
- expect(yarnRmDetails.value).to.be.eql(expectedYarnRmHaValue);
- expect(yarnRmDetails.recommendedValue).to.be.eql(expectedYarnRmHaValue);
- expect(yarnRmDetails.displayName).to.be.eql('yarn.resourcemanager.ha');
- expect(yarnRmDetails.description).to.be.eql('Comma separated yarn resourcemanager host addresses with port');
+ expect(this.yarnRmDetails.value).to.be.equal(expectedYarnRmHaValue);
+ expect(this.yarnRmDetails.recommendedValue).to.be.equal(expectedYarnRmHaValue);
+ expect(this.yarnRmDetails.displayName).to.be.equal('yarn.resourcemanager.ha');
+ expect(this.yarnRmDetails.description).to.be.equal('Comma separated yarn resourcemanager host addresses with port');
+ });
+ it('yarn.resourcemanager.scheduler.ha__yarn-client', function() {
var expectedYarnRmSchedulerValue = 'c6401.ambari.apache.org:8030,c6402.ambari.apache.org:8030';
- expect(yarnRmSchedulerDetails.value).to.be.eql(expectedYarnRmSchedulerValue);
- expect(yarnRmSchedulerDetails.recommendedValue).to.be.eql(expectedYarnRmSchedulerValue);
- expect(yarnRmSchedulerDetails.displayName).to.be.eql('yarn.resourcemanager.scheduler.ha');
- expect(yarnRmSchedulerDetails.description).to.be.eql('Comma separated yarn resourcemanager scheduler addresses with port');
-
- var noOfConfigsAdded = 2;
- expect(configs.length).to.be.eql(inputConfigsCount + noOfConfigsAdded) ;
+ expect(this.yarnRmSchedulerDetails.value).to.be.equal(expectedYarnRmSchedulerValue);
+ expect(this.yarnRmSchedulerDetails.recommendedValue).to.be.equal(expectedYarnRmSchedulerValue);
+ expect(this.yarnRmSchedulerDetails.displayName).to.be.equal('yarn.resourcemanager.scheduler.ha');
+ expect(this.yarnRmSchedulerDetails.description).to.be.equal('Comma separated yarn resourcemanager scheduler addresses with port');
});
});
@@ -1776,20 +1783,43 @@ describe('App.InstallerStep7Controller', function () {
}
];
- it('should add three security related configs for HAWQ if Kerberos is enabled', function () {
- var originalConfigsLength = configs.length;
+ beforeEach(function () {
+ this.originalConfigsLength = configs.length;
installerStep7Controller.addHawqConfigsOnKerberizedCluster(configs);
+ });
+
+ it('should add three security related configs for HAWQ if Kerberos is enabled', function () {
// ensure 3 new configs are added
- expect(configs.length - originalConfigsLength).to.be.eql(3);
- // check if all three new properties were added
- secureProperties.forEach(function (newProperty) {
- var newPropertyAdded = configs.findProperty('id', newProperty.name + '__' + newProperty.file);
- expect(newPropertyAdded.name).to.be.eql(newProperty.name);
- expect(newPropertyAdded.displayName).to.be.eql(newProperty.name);
- expect(newPropertyAdded.value).to.be.eql(newProperty.value);
- expect(newPropertyAdded.recommendedValue).to.be.eql(newProperty.value);
- expect(newPropertyAdded.isOverridable).to.be.eql(newProperty.isOverridable);
- expect(newPropertyAdded.isReconfigurable).to.be.eql(newProperty.isReconfigurable);
+ expect(configs.length - this.originalConfigsLength).to.be.eql(3);
+ });
+
+ // check if all three new properties were added
+ secureProperties.forEach(function (newProperty) {
+ var id = newProperty.name + '__' + newProperty.file;
+ describe(id, function () {
+
+ beforeEach(function () {
+ this.newPropertyAdded = configs.findProperty('id', id);
+ });
+
+ it('#name', function () {
+ expect(this.newPropertyAdded.name).to.be.equal(newProperty.name);
+ });
+ it('#displayName', function () {
+ expect(this.newPropertyAdded.displayName).to.be.equal(newProperty.name);
+ });
+ it('#value', function () {
+ expect(this.newPropertyAdded.value).to.be.equal(newProperty.value);
+ });
+ it('#recommendedValue', function () {
+ expect(this.newPropertyAdded.recommendedValue).to.be.equal(newProperty.value);
+ });
+ it('#isOverridable', function () {
+ expect(this.newPropertyAdded.isOverridable).to.be.equal(newProperty.isOverridable);
+ });
+ it('#isReconfigurable', function () {
+ expect(this.newPropertyAdded.isReconfigurable).to.be.equal(newProperty.isReconfigurable);
+ });
});
});
});
@@ -2320,8 +2350,6 @@ describe('App.InstallerStep7Controller', function () {
describe('#addServiceController', function () {
- var installedServices = [];
-
beforeEach(function () {
installerStep7Controller.set('wizardController', {name: 'addServiceController'});
this.stub = sinon.stub(App.configsCollection, 'getConfigByName');
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/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 14b7293..62168b6 100644
--- a/ambari-web/test/controllers/wizard/step8_test.js
+++ b/ambari-web/test/controllers/wizard/step8_test.js
@@ -17,7 +17,6 @@
*/
var App = require('app');
-var modelSetup = require('test/init_model_test');
require('utils/ajax/ajax_queue');
require('controllers/main/service/info/configs');
require('controllers/wizard/step8_controller');
@@ -432,10 +431,10 @@ describe('App.WizardStep8Controller', function () {
isNotDefaultValue: false
})
});
- var configs = Em.A([Em.Object.create({
+ var _configs = Em.A([Em.Object.create({
name: 'property'
})]);
- expect(installerStep8Controller.isConfigsChanged(properties,configs)).to.be.true;
+ expect(installerStep8Controller.isConfigsChanged(properties, _configs)).to.be.true;
});
});
@@ -1186,7 +1185,7 @@ describe('App.WizardStep8Controller', function () {
installerStep8Controller.deleteClusters(clusterNames);
expect(App.ajax.send.callCount).to.equal(clusterNames.length);
clusterNames.forEach(function(n, i) {
- expect(App.ajax.send.getCall(i).args[0].data).to.eql({name: n, isLast: i == clusterNames.length - 1});
+ expect(App.ajax.send.getCall(i).args[0].data).to.eql({name: n, isLast: i === clusterNames.length - 1});
});
});
@@ -1199,7 +1198,7 @@ describe('App.WizardStep8Controller', function () {
describe('#createStormSiteObj', function() {
it('should replace quote \'"\' to "\'" for some properties', function() {
- var configs = [
+ var _configs = [
{filename: 'storm-site.xml', value: ["a", "b"], name: 'storm.zookeeper.servers'}
],
expected = {
@@ -1209,12 +1208,12 @@ describe('App.WizardStep8Controller', function () {
'storm.zookeeper.servers': '[\'a\',\'b\']'
}
};
- installerStep8Controller.reopen({configs: configs});
+ installerStep8Controller.reopen({configs: _configs});
expect(installerStep8Controller.createStormSiteObj('version1')).to.eql(expected);
});
it('should not escape special characters', function() {
- var configs = [
+ var _configs = [
{filename: 'storm-site.xml', value: "abc\n\t", name: 'nimbus.childopts'},
{filename: 'storm-site.xml', value: "a\nb", name: 'supervisor.childopts'},
{filename: 'storm-site.xml', value: "a\t\tb", name: 'worker.childopts'}
@@ -1228,7 +1227,7 @@ describe('App.WizardStep8Controller', function () {
'worker.childopts': 'a\t\tb'
}
};
- installerStep8Controller.reopen({configs: configs});
+ installerStep8Controller.reopen({configs: _configs});
expect(installerStep8Controller.createStormSiteObj('version1')).to.eql(expected);
});
});
@@ -1967,7 +1966,7 @@ describe('App.WizardStep8Controller', function () {
expect(data.properties['ambari.dispatch.credential.password']).to.equal('pwd');
});
it('custom property is valid', function () {
- expect(data.properties['some_p']).to.equal('some_v');
+ expect(data.properties.some_p).to.equal('some_v');
});
});
[2/3] ambari git commit: AMBARI-14626. UI UT cleanup (onechiporenko)
Posted by on...@apache.org.
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/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 03c072f..70365bb 100644
--- a/ambari-web/test/controllers/wizard/step9_test.js
+++ b/ambari-web/test/controllers/wizard/step9_test.js
@@ -342,7 +342,7 @@ describe('App.InstallerStep9Controller', function () {
});
});
- var hosts_for_load_and_render = {
+ var hostsForLoadAndRender = {
'host1': {
message: 'message1',
status: 'unknown',
@@ -387,23 +387,23 @@ describe('App.InstallerStep9Controller', function () {
describe('#loadHosts', function () {
beforeEach(function() {
- c.reopen({content: {hosts: hosts_for_load_and_render}});
+ c.reopen({content: {hosts: hostsForLoadAndRender}});
c.loadHosts();
});
it('Only REGISTERED hosts', function () {
- var loaded_hosts = c.get('hosts');
- expect(loaded_hosts.length).to.equal(2);
+ var loadedHosts = c.get('hosts');
+ expect(loadedHosts.length).to.equal(2);
});
it('All hosts have progress 0', function () {
- var loaded_hosts = c.get('hosts');
- expect(loaded_hosts.everyProperty('progress', 0)).to.equal(true);
+ var loadedHosts = c.get('hosts');
+ expect(loadedHosts.everyProperty('progress', 0)).to.equal(true);
});
it('All host don\'t have logTasks', function () {
- var loaded_hosts = c.get('hosts');
- expect(loaded_hosts.everyProperty('logTasks.length', 0)).to.equal(true);
+ var loadedHosts = c.get('hosts');
+ expect(loadedHosts.everyProperty('logTasks.length', 0)).to.equal(true);
});
});
@@ -589,7 +589,7 @@ describe('App.InstallerStep9Controller', function () {
describe('#launchStartServices', function () {
beforeEach(function() {
sinon.stub(App, 'get', function(k) {
- if (k === 'components.slaves')
+ if (k === 'components.slaves') {
return ["TASKTRACKER", "DATANODE",
"JOURNALNODE", "ZKFC",
"APP_TIMELINE_SERVER",
@@ -598,6 +598,7 @@ describe('App.InstallerStep9Controller', function () {
"HBASE_REGIONSERVER",
"SUPERVISOR",
"FLUME_HANDLER"];
+ }
return true;
});
});
@@ -870,8 +871,9 @@ describe('App.InstallerStep9Controller', function () {
beforeEach(function() {
sinon.stub(App, 'get', function(k) {
- if (k === 'components.slaves')
+ if (k === 'components.slaves') {
return ["TASKTRACKER", "DATANODE", "JOURNALNODE", "ZKFC", "APP_TIMELINE_SERVER", "NODEMANAGER", "GANGLIA_MONITOR", "HBASE_REGIONSERVER", "SUPERVISOR", "FLUME_HANDLER"];
+ }
return Em.get(App, k);
});
});
@@ -964,7 +966,7 @@ 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);
+ expect(test.host.message === test.e.message).to.equal(test.e.b);
});
});
});
@@ -1163,8 +1165,9 @@ describe('App.InstallerStep9Controller', function () {
beforeEach(function() {
sinon.stub(App, 'get', function(k) {
- if (k === 'components.slaves')
+ if (k === 'components.slaves') {
return ["TASKTRACKER", "DATANODE", "JOURNALNODE", "ZKFC", "APP_TIMELINE_SERVER", "NODEMANAGER", "GANGLIA_MONITOR", "HBASE_REGIONSERVER", "SUPERVISOR", "FLUME_HANDLER"];
+ }
return Em.get(App, k);
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/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 08d9d89..8ffa697 100644
--- a/ambari-web/test/controllers/wizard_test.js
+++ b/ambari-web/test/controllers/wizard_test.js
@@ -22,41 +22,41 @@ require('controllers/wizard');
var c;
+function getSteps(start, count) {
+ var steps = [];
+ for (var j = start; j <= count; j++) {
+ steps.push(Em.Object.create({step: j, value: false}));
+ }
+ return steps;
+}
+
describe('App.WizardController', function () {
var wizardController = App.WizardController.create({});
var totalSteps = 11;
- var ruller = [];
- for(var i = 0; i < totalSteps; i++) {
- ruller.push(i);
- }
-
+ var ruller = d3.range(0, totalSteps);
+ var i;
beforeEach(function () {
c = App.WizardController.create({});
});
- describe('#setLowerStepsDisable', function() {
- for(var i = 1; i < totalSteps; i++) {
- var indx = i;
- var steps = [];
- for(var j = 1; j <= indx; j++) {
- steps.push(Em.Object.create({step:j,value:false}));
- }
- wizardController.set('isStepDisabled', steps);
- for(j = 1; j <= indx; j++) {
- it('Steps: ' + i + ' | Disabled: ' + (j-1), function() {
- wizardController.setLowerStepsDisable(j);
- expect(wizardController.get('isStepDisabled').filterProperty('value', true).length).to.equal(j-1);
- });
- }
- }
+ describe('#setLowerStepsDisable', function () {
+ var steps = getSteps(1, 10);
+ wizardController.set('isStepDisabled', steps);
+ steps.forEach(function (step) {
+ var index = step.get('step');
+ it('Steps: 10 | Disabled: ' + (index - 1), function () {
+ wizardController.setLowerStepsDisable(index);
+ expect(wizardController.get('isStepDisabled').filterProperty('value', true).length).to.be.equal(index - 1);
+ });
+ });
});
// isStep0 ... isStep10 tests
App.WizardController1 = App.WizardController.extend({currentStep:''});
var tests = [];
- for (var i = 0; i < totalSteps; i++) {
+ for (i = 0; i < totalSteps; i++) {
var n = ruller.slice(0);
n.splice(i, 1);
tests.push({i: i, n: n});
@@ -65,11 +65,13 @@ describe('App.WizardController', function () {
describe('isStep' + test.i, function () {
var w = App.WizardController1.create();
w.set('currentStep', test.i);
- it('Current Step is ' + test.i + ', so isStep' + test.i + ' is TRUE', function () {
+
+ it('Current Step is {0}, so isStep{1} is TRUE'.format(test.i, test.i), function () {
expect(w.get('isStep' + test.i)).to.equal(true);
});
+
test.n.forEach(function (indx) {
- it('Current Step is ' + test.i + ', so isStep' + indx + ' is FALSE', function () {
+ it('Current Step is {0}, so isStep{1} is FALSE'.format(test.i, indx), function () {
expect(w.get('isStep' + indx)).to.equal(false);
});
});
@@ -79,14 +81,11 @@ describe('App.WizardController', function () {
describe('#gotoStep', function() {
var w = App.WizardController1.create();
- var steps = [];
- for(var j = 0; j < totalSteps; j++) {
- steps.push(Em.Object.create({step:j,value:false}));
- }
+ var steps = getSteps(0, totalSteps - 1);
steps.forEach(function(step, index) {
step.set('value', true);
w.set('isStepDisabled', steps);
- it('step ' + index + ' is disabled, so gotoStep('+index+') is not possible', function() {
+ it('step {0} is disabled, so gotoStep({1}) is not possible'.format(index, index), function() {
expect(w.gotoStep(index)).to.equal(false);
});
});
@@ -284,8 +283,7 @@ describe('App.WizardController', function () {
});
describe('#finishLoading', function () {
- var callback = sinon.spy(),
- stepController = App.get('router.wizardStep3Controller'),
+ var stepController = App.get('router.wizardStep3Controller'),
cases = [
{
requestId: null,
@@ -691,11 +689,6 @@ describe('App.WizardController', function () {
App.ajax.send.restore();
});
it('should call callbeck with data', function () {
- var jsonData = {
- Requests: {
- id: 1
- }
- };
wizardController.set('content', Em.Object.create({
cluster: {
oldRequestsId: '1'
@@ -846,7 +839,7 @@ describe('App.WizardController', function () {
sinon.stub(App.MainAdminServiceAccountsController,'create').returns({
loadUsers: function() {},
get: function(type) {
- if (type == 'dataIsLoaded') {
+ if (type === 'dataIsLoaded') {
return true;
}
return Em.Object.create({
@@ -1502,9 +1495,7 @@ describe('App.WizardController', function () {
});
sinon.stub(App.themesMapper, 'generateAdvancedTabs').returns(true);
sinon.stub(App.config, 'loadConfigsFromStack').returns({
- done: function(callback) {
- callback();
- }
+ done: Em.clb
});
sinon.stub(App.StackService, 'find').returns(Em.A([
Em.Object.create({
@@ -1521,16 +1512,16 @@ describe('App.WizardController', function () {
App.themesMapper.generateAdvancedTabs.restore();
wizardController.loadConfigThemeForServices.restore();
});
- it('Should load config themes', function() {
+ it('Should load config themes', function(done) {
this.stub.returns(true);
- wizardController.loadConfigThemes().then(function(data) {
- expect().to.be.undefined;
+ wizardController.loadConfigThemes().then(function() {
+ done();
});
});
- it('Should load config themes (2)', function() {
+ it('Should load config themes (2)', function(done) {
this.stub.returns(false);
- wizardController.loadConfigThemes().then(function(data) {
- expect().to.be.undefined;
+ wizardController.loadConfigThemes().then(function() {
+ done();
});
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/data/HDP2.2/site_properties_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/data/HDP2.2/site_properties_test.js b/ambari-web/test/data/HDP2.2/site_properties_test.js
index a5e0e18..14599b3 100644
--- a/ambari-web/test/data/HDP2.2/site_properties_test.js
+++ b/ambari-web/test/data/HDP2.2/site_properties_test.js
@@ -16,7 +16,6 @@
* limitations under the License.
*/
-var App = require('app');
require('utils/helper');
require('data/HDP2/gluster_fs_properties');
var siteProperties = require('data/HDP2.2/site_properties').configProperties;
@@ -26,7 +25,7 @@ describe('hdp2SiteProperties', function () {
* @stackProperties: All the properties that are derived from stack definition
*/
var stackProperties = siteProperties.filter(function(item){
- return !(item.isRequiredByAgent === false || item.category === 'Ambari Principals')
+ return !(item.isRequiredByAgent === false || item.category === 'Ambari Principals')
});
stackProperties.forEach(function(siteProperty){
@@ -43,7 +42,7 @@ describe('hdp2SiteProperties', function () {
* showLabel
* unit
*/
- describe('Check attributes of "' + siteProperty.filename + '/' + siteProperty.name + '"' + '. Stack driven attributes should be undefined ', function () {
+ describe('Check attributes of "{0}/{1}". Stack driven attributes should be undefined '.format(siteProperty.filename, siteProperty.name), function () {
['isVisible', 'value', 'recommendedValue', 'description', 'isReconfigurable', 'isRequired', 'displayName', 'showLabel', 'unit'].forEach(function (p) {
it(p, function () {
expect(siteProperty[p]).to.not.exist;
@@ -55,7 +54,7 @@ describe('hdp2SiteProperties', function () {
* displayTypes <code>supportTextConnection<code> and <code>radio button<code>
* can be used as exception. Other displayTypes values should be used in stack definition
*/
- it('Check attributes of "' + siteProperty.filename + '/' + siteProperty.name + '"' + '. Display type value ' + siteProperty.displayType + ' should be described in stack ', function () {
+ it('Check attributes of "{0}/{1}". Display type value {2} should be described in stack '.format(siteProperty.filename, siteProperty.name, siteProperty.displayType), function () {
expect(siteProperty.displayType).to.match(/undefined|supportTextConnection|radio button/);
});
@@ -64,7 +63,7 @@ describe('hdp2SiteProperties', function () {
* name
* filename
*/
- describe('Check primary attributes of "' + siteProperty.filename + '/' + siteProperty.name + '"' + '. Attributes that uniquely represent a property should be defined ', function () {
+ describe('Check primary attributes of "{0}/{1}". Attributes that uniquely represent a property should be defined '.format(siteProperty.filename, siteProperty.name), function () {
it('name', function () {
expect(siteProperty.name).to.not.equal(undefined);
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/data/HDP2.3/site_properties_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/data/HDP2.3/site_properties_test.js b/ambari-web/test/data/HDP2.3/site_properties_test.js
index b94e0b2..6ce9c17 100644
--- a/ambari-web/test/data/HDP2.3/site_properties_test.js
+++ b/ambari-web/test/data/HDP2.3/site_properties_test.js
@@ -16,7 +16,6 @@
* limitations under the License.
*/
-var App = require('app');
require('utils/helper');
require('data/HDP2/gluster_fs_properties');
var siteProperties = require('data/HDP2.3/site_properties').configProperties;
@@ -26,7 +25,7 @@ describe('hdp2SiteProperties', function () {
* @stackProperties: All the properties that are derived from stack definition
*/
var stackProperties = siteProperties.filter(function(item){
- return !(item.isRequiredByAgent === false || item.category === 'Ambari Principals')
+ return !(item.isRequiredByAgent === false || item.category === 'Ambari Principals')
});
stackProperties.forEach(function(siteProperty){
@@ -43,7 +42,7 @@ describe('hdp2SiteProperties', function () {
* showLabel
* unit
*/
- describe('Check attributes of "' + siteProperty.filename + '/' + siteProperty.name + '"' + '. Stack driven attributes should be undefined ', function () {
+ describe('Check attributes of "{0}/{1}". Stack driven attributes should be undefined '.format(siteProperty.filename, siteProperty.name), function () {
['isVisible', 'value', 'recommendedValue', 'description', 'isReconfigurable', 'isRequired', 'displayName', 'showLabel', 'unit'].forEach(function (p) {
it(p, function () {
expect(siteProperty[p]).to.not.exist;
@@ -56,7 +55,7 @@ describe('hdp2SiteProperties', function () {
* displayTypes <code>supportTextConnection<code> and <code>radio button<code>
* can be used as exception. Other displayTypes values should be used in stack definition
*/
- it('Check attributes of "' + siteProperty.filename + '/' + siteProperty.name + '"' + '. Display type value ' + siteProperty.displayType + ' should be described in stack ', function () {
+ it('Check attributes of "{0}/{1}". Display type value {2} should be described in stack '.format(siteProperty.filename, siteProperty.name, siteProperty.displayType), function () {
expect(siteProperty.displayType).to.match(/undefined|supportTextConnection|radio button/);
});
@@ -65,7 +64,7 @@ describe('hdp2SiteProperties', function () {
* name
* filename
*/
- describe('Check primary attributes of "' + siteProperty.filename + '/' + siteProperty.name + '"' + '. Attributes that uniquely represent a property should be defined ', function () {
+ describe('Check primary attributes of "{0}/{1}". Attributes that uniquely represent a property should be defined '.format(siteProperty.filename, siteProperty.name), function () {
it('name', function () {
expect(siteProperty.name).to.not.equal(undefined);
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/data/HDP2/secure_mapping_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/data/HDP2/secure_mapping_test.js b/ambari-web/test/data/HDP2/secure_mapping_test.js
index e7082f2..766243f 100644
--- a/ambari-web/test/data/HDP2/secure_mapping_test.js
+++ b/ambari-web/test/data/HDP2/secure_mapping_test.js
@@ -16,7 +16,6 @@
* limitations under the License.
*/
-var App = require('app');
require('utils/helper');
var mappedHdp2Properties = require('data/HDP2/secure_mapping');
@@ -24,12 +23,12 @@ describe('hdp2SiteMapping', function () {
// All mapped properties should have value of string type
mappedHdp2Properties.forEach(function(mappedProperty){
- it('Value of "' + mappedProperty.name + '"' + ' should be string', function () {
+ it('Value of "{0}" should be string'.format(mappedProperty.name), function () {
expect(mappedProperty.value).to.be.a('string');
});
});
mappedHdp2Properties.forEach(function(mappedProperty){
- it('Value of "' + mappedProperty.name + '"' + ' should have serviceName and filename attribute', function () {
+ it('Value of "{0}" should have serviceName and filename attribute'.format(mappedProperty.name), function () {
expect(mappedProperty).to.have.property('serviceName');
expect(mappedProperty).to.have.property('filename');
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/data/HDP2/site_properties_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/data/HDP2/site_properties_test.js b/ambari-web/test/data/HDP2/site_properties_test.js
index 26be9c3..c8b7bbc 100644
--- a/ambari-web/test/data/HDP2/site_properties_test.js
+++ b/ambari-web/test/data/HDP2/site_properties_test.js
@@ -16,7 +16,6 @@
* limitations under the License.
*/
-var App = require('app');
require('utils/helper');
require('data/HDP2/gluster_fs_properties');
var siteProperties = require('data/HDP2/site_properties').configProperties;
@@ -26,7 +25,7 @@ describe('hdp2SiteProperties', function () {
* @stackProperties: All the properties that are derived from stack definition
*/
var stackProperties = siteProperties.filter(function(item){
- return !(item.isRequiredByAgent === false || item.category === 'Ambari Principals')
+ return !(item.isRequiredByAgent === false || item.category === 'Ambari Principals')
});
stackProperties.forEach(function(siteProperty){
@@ -43,7 +42,7 @@ describe('hdp2SiteProperties', function () {
* showLabel
* unit
*/
- describe('Check attributes of "' + siteProperty.filename + '/' + siteProperty.name + '"' + '. Stack driven attributes should be undefined ', function () {
+ describe('Check attributes of "{0}/{1}". Stack driven attributes should be undefined '.format(siteProperty.filename, siteProperty.name), function () {
['isVisible', 'value', 'recommendedValue', 'description', 'isReconfigurable', 'isRequired', 'displayName', 'showLabel', 'unit'].forEach(function (p) {
it(p, function () {
expect(siteProperty[p]).to.not.exist;
@@ -55,7 +54,7 @@ describe('hdp2SiteProperties', function () {
* displayTypes <code>supportTextConnection<code> and <code>radio button<code>
* can be used as exception. Other displayTypes values should be used in stack definition
*/
- it('Check attributes of "' + siteProperty.filename + '/' + siteProperty.name + '"' + '. Display type value ' + siteProperty.displayType + ' should be described in stack ', function () {
+ it('Check attributes of "{0}/{1}". Display type value {2} should be described in stack '.format(siteProperty.filename, siteProperty.name, siteProperty.displayType), function () {
expect(siteProperty.displayType).to.match(/undefined|supportTextConnection|radio button/);
});
@@ -64,7 +63,7 @@ describe('hdp2SiteProperties', function () {
* name
* filename
*/
- describe('Check primary attributes of "' + siteProperty.filename + '/' + siteProperty.name + '"' + '. Attributes that uniquely represent a property should be defined ', function () {
+ describe('Check primary attributes of "{0}/{1}". Attributes that uniquely represent a property should be defined '.format(siteProperty.filename, siteProperty.name), function () {
it('name', function () {
expect(siteProperty.name).to.not.equal(undefined);
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/init_computed_aliases.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/init_computed_aliases.js b/ambari-web/test/init_computed_aliases.js
index 62d0842..57e0861 100644
--- a/ambari-web/test/init_computed_aliases.js
+++ b/ambari-web/test/init_computed_aliases.js
@@ -40,10 +40,9 @@ App.TestAliases = {
/**
* Stub <code>get</code> for <code>App</code> or <code>self</code>
*
- * @param {Ember.Object} self
* @returns {App.TestAliases}
*/
- smartStubGet: function (self) {
+ smartStubGet: function () {
var args = [].slice.call(arguments);
if (args.length === 3) {
return this._stubOneKey.apply(this, args);
@@ -156,7 +155,7 @@ App.TestAliases = {
for (var y = 0; y < allCombos; y++) {
var combo = {};
for (var x = 0; x < n; x++) {
- combo[dependentKeys[x]] = !!((y >> x) & 1);
+ combo[dependentKeys[x]] = !!(y >> x & 1);
}
result.push(combo);
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/init_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/init_test.js b/ambari-web/test/init_test.js
index 8b1cfab..df64cbe 100644
--- a/ambari-web/test/init_test.js
+++ b/ambari-web/test/init_test.js
@@ -29,10 +29,10 @@ if (!Function.prototype.bind) {
throw new TypeError('Function.prototype.bind - what is trying to be bound is not callable');
}
- var aArgs = Array.prototype.slice.call(arguments, 1),
+ var aArgs = Array.prototype.slice.call(arguments, 1),
fToBind = this,
- fNOP = function() {},
- fBound = function() {
+ fNOP = function() {},
+ fBound = function() {
return fToBind.apply(this instanceof fNOP
? this
: oThis,
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/login_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/login_test.js b/ambari-web/test/login_test.js
index 1975b2d..b72ab94 100644
--- a/ambari-web/test/login_test.js
+++ b/ambari-web/test/login_test.js
@@ -16,29 +16,8 @@
* limitations under the License.
*/
-var App = require('app');
-
require('controllers/login_controller');
describe('App.LoginController', function () {
-
- var loginController = App.LoginController.create();
-
- describe('#validateCredentials()', function () {
- /*
- it('should return undefined if no username is present', function () {
- loginController.set('loginName', '');
- expect(loginController.validateCredentials()).to.equal(undefined);
- })
- it('should return undefined if no password is present', function () {
- loginController.set('password', '');
- expect(loginController.validateCredentials()).to.equal(undefined);
- })
- it('should return the user object with the specified username and password (dummy until actual integration)', function () {
- loginController.set('loginName', 'admin');
- loginController.set('password', 'admin');
- expect(loginController.validateCredentials().get('loginName'), 'admin');
- })
- */
- })
+ describe('#validateCredentials()', function () {});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/mappers/alert_definitions_mapper_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mappers/alert_definitions_mapper_test.js b/ambari-web/test/mappers/alert_definitions_mapper_test.js
index 180e728..6626187 100644
--- a/ambari-web/test/mappers/alert_definitions_mapper_test.js
+++ b/ambari-web/test/mappers/alert_definitions_mapper_test.js
@@ -201,7 +201,7 @@ describe('App.alertDefinitionsMapper', function () {
});
sinon.stub(App.router, 'get', function() {return false;});
- App.cache['previousAlertGroupsMap'] = {};
+ App.cache.previousAlertGroupsMap = {};
sinon.stub(App.alertDefinitionsMapper, 'setMetricsSourcePropertyLists', Em.K);
sinon.stub(App.alertDefinitionsMapper, 'setAlertDefinitionsRawSourceData', Em.K);
@@ -224,7 +224,7 @@ describe('App.alertDefinitionsMapper', function () {
App.alertDefinitionsMapper.deleteRecord.restore();
App.router.get.restore();
- App.cache['previousAlertGroupsMap'] = {};
+ App.cache.previousAlertGroupsMap = {};
App.alertDefinitionsMapper.setMetricsSourcePropertyLists.restore();
App.alertDefinitionsMapper.setAlertDefinitionsRawSourceData.restore();
@@ -403,7 +403,7 @@ describe('App.alertDefinitionsMapper', function () {
it('should set groups from App.cache.previousAlertGroupsMap', function () {
- App.cache['previousAlertGroupsMap'] = {
+ App.cache.previousAlertGroupsMap = {
1: [5,1],
2: [4,3],
3: [3,2],
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/mappers/alert_groups_mapper_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mappers/alert_groups_mapper_test.js b/ambari-web/test/mappers/alert_groups_mapper_test.js
index eb83759..9480e3d 100644
--- a/ambari-web/test/mappers/alert_groups_mapper_test.js
+++ b/ambari-web/test/mappers/alert_groups_mapper_test.js
@@ -93,7 +93,7 @@ describe('App.alertGroupsMapper', function () {
});
App.alertGroupsMapper.set('model', {});
- App.cache['previousAlertGroupsMap'] = {};
+ App.cache.previousAlertGroupsMap = {};
});
@@ -102,10 +102,11 @@ describe('App.alertGroupsMapper', function () {
App.store.commit.restore();
App.store.loadMany.restore();
App.alertGroupsMapper.set('model', App.AlertGroup);
- App.cache['previousAlertGroupsMap'] = {};
+ App.cache.previousAlertGroupsMap = {};
});
+ /*eslint-disable mocha-cleanup/asserts-limit */
it('should parse alert groups', function() {
var expected = [
@@ -126,12 +127,10 @@ describe('App.alertGroupsMapper', function () {
];
App.alertGroupsMapper.map(json);
-
var mapped = App.alertGroupsMapper.get('model.content');
-
testHelpers.nestedExpect(expected, mapped);
-
});
+ /*eslint-enable mocha-cleanup/asserts-limit */
it('should set App.cache.previousAlertGroupsMap', function () {
@@ -149,7 +148,7 @@ describe('App.alertGroupsMapper', function () {
App.alertGroupsMapper.map(json);
- expect(App.cache['previousAlertGroupsMap']).to.eql(expected);
+ expect(App.cache.previousAlertGroupsMap).to.eql(expected);
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/mappers/alert_instances_mapper_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mappers/alert_instances_mapper_test.js b/ambari-web/test/mappers/alert_instances_mapper_test.js
index 6ea0086..efa5531 100644
--- a/ambari-web/test/mappers/alert_instances_mapper_test.js
+++ b/ambari-web/test/mappers/alert_instances_mapper_test.js
@@ -21,13 +21,7 @@ require('mappers/alert_instances_mapper');
describe('App.alertInstanceMapper', function () {
- var alertInstances = [
- {id: 1},
- {id: 2},
- {id: 3},
- {id: 4}
- ],
- json = {
+ var json = {
"items": [
{
"Alert": {
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/mappers/hosts_mapper_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mappers/hosts_mapper_test.js b/ambari-web/test/mappers/hosts_mapper_test.js
index 5e5c293..1d7d80a 100644
--- a/ambari-web/test/mappers/hosts_mapper_test.js
+++ b/ambari-web/test/mappers/hosts_mapper_test.js
@@ -16,7 +16,6 @@
* limitations under the License.
*/
-var Ember = require('ember');
var App = require('app');
require('models/host');
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/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 9c4adbb..d144afa 100644
--- a/ambari-web/test/mappers/server_data_mapper_test.js
+++ b/ambari-web/test/mappers/server_data_mapper_test.js
@@ -16,7 +16,6 @@
* limitations under the License.
*/
-var Ember = require('ember');
var App = require('app');
var mapper;
@@ -24,7 +23,7 @@ require('mappers/server_data_mapper');
describe('App.QuickDataMapper', function () {
- var test_json = {
+ var testJson = {
a1: {
b1: {
c1: 'val1'
@@ -62,7 +61,7 @@ describe('App.QuickDataMapper', function () {
];
tests.forEach(function(test) {
it(test.i, function() {
- expect(mapper.getJsonProperty(test_json, test.i)).to.equal(test.e);
+ expect(mapper.getJsonProperty(testJson, test.i)).to.equal(test.e);
});
});
});
@@ -82,7 +81,7 @@ describe('App.QuickDataMapper', function () {
var result;
beforeEach(function () {
- result = mapper.parseIt(test_json, config);
+ result = mapper.parseIt(testJson, config);
});
it('Property starts with $', function() {
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/mappers/service_mapper_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mappers/service_mapper_test.js b/ambari-web/test/mappers/service_mapper_test.js
index 270147a..0634f19 100644
--- a/ambari-web/test/mappers/service_mapper_test.js
+++ b/ambari-web/test/mappers/service_mapper_test.js
@@ -16,7 +16,6 @@
* limitations under the License.
*/
-var Ember = require('ember');
var App = require('app');
require('utils/helper');
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/mappers/stack_mapper_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mappers/stack_mapper_test.js b/ambari-web/test/mappers/stack_mapper_test.js
index 7b124af..0bc0f3c 100644
--- a/ambari-web/test/mappers/stack_mapper_test.js
+++ b/ambari-web/test/mappers/stack_mapper_test.js
@@ -16,7 +16,6 @@
* limitations under the License.
*/
-var Ember = require('ember');
var App = require('app');
require('mappers/server_data_mapper');
require('mappers/stack_mapper');
@@ -27,7 +26,7 @@ require('models/repository');
describe('App.stackMapper', function () {
describe("#map", function() {
- var test_data = {
+ var testData = {
items: [{
"Versions" : {
"active" : true,
@@ -261,7 +260,7 @@ describe('App.stackMapper', function () {
App.resetDsStoreTypeMap(App.OperatingSystem);
App.resetDsStoreTypeMap(App.Stack);
sinon.stub(App.store, 'commit', Em.K);
- App.stackMapper.map(test_data);
+ App.stackMapper.map(testData);
});
afterEach(function(){
App.store.commit.restore();
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/mappers/status_mapper_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mappers/status_mapper_test.js b/ambari-web/test/mappers/status_mapper_test.js
index 3ca5be9..dce5254 100644
--- a/ambari-web/test/mappers/status_mapper_test.js
+++ b/ambari-web/test/mappers/status_mapper_test.js
@@ -16,12 +16,4 @@
* limitations under the License.
*/
-var Ember = require('ember');
-var App = require('app');
-
-require('mappers/server_data_mapper');
-
-describe('App.statusMapper', function () {
-
-
-});
+describe('App.statusMapper', function () {});
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/mappers/users_mapper_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mappers/users_mapper_test.js b/ambari-web/test/mappers/users_mapper_test.js
index 2ff0cd7..22c2466 100644
--- a/ambari-web/test/mappers/users_mapper_test.js
+++ b/ambari-web/test/mappers/users_mapper_test.js
@@ -16,7 +16,6 @@
* limitations under the License.
*/
-var Ember = require('ember');
var App = require('app');
require('mappers/server_data_mapper');
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/mixins/common/configs/config_recommendations_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mixins/common/configs/config_recommendations_test.js b/ambari-web/test/mixins/common/configs/config_recommendations_test.js
index ad529b9..3f7d6b1 100644
--- a/ambari-web/test/mixins/common/configs/config_recommendations_test.js
+++ b/ambari-web/test/mixins/common/configs/config_recommendations_test.js
@@ -19,7 +19,7 @@
var App = require('app');
describe('App.ConfigRecommendations', function() {
- var mixinObject = Em.Controller.extend(App.ConfigRecommendations, {});
+ var mixinObject = Em.Controller.extend(App.ConfigRecommendations, {});
var instanceObject = mixinObject.create({});
beforeEach(function() {
@@ -307,7 +307,7 @@ describe('App.ConfigRecommendations', function() {
expect(instanceObject.getRecommendation('p1', 'f1')).to.eql(recommendations[0]);
});
- it('get recommendation for default group', function () {
+ it('get recommendation for default group (2)', function () {
expect(instanceObject.getRecommendation('p1', 'f1', 'group1')).to.eql(recommendations[2]);
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/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 5bf6f26..2156a46 100644
--- a/ambari-web/test/mixins/common/configs/configs_saver_test.js
+++ b/ambari-web/test/mixins/common/configs/configs_saver_test.js
@@ -19,7 +19,7 @@
var App = require('app');
describe('App.ConfigsSaverMixin', function() {
- var mixinObject = Em.Controller.extend(App.ConfigsSaverMixin, {});
+ var mixinObject = Em.Controller.extend(App.ConfigsSaverMixin, {});
var instanceObject = mixinObject.create({});
describe('#allowSaveSite()', function() {
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/mixins/common/configs/toggle_isrequired_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mixins/common/configs/toggle_isrequired_test.js b/ambari-web/test/mixins/common/configs/toggle_isrequired_test.js
index c4bdd23..49865db 100644
--- a/ambari-web/test/mixins/common/configs/toggle_isrequired_test.js
+++ b/ambari-web/test/mixins/common/configs/toggle_isrequired_test.js
@@ -19,8 +19,7 @@
var App = require('app');
describe('#_overrideConfigIsRequired', function () {
- var controller,
- instanceObject,
+ var instanceObject,
configs,
serviceConfig;
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/mixins/common/kdc_credentials_controller_mixin_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mixins/common/kdc_credentials_controller_mixin_test.js b/ambari-web/test/mixins/common/kdc_credentials_controller_mixin_test.js
index edfed5f..20f6b76 100644
--- a/ambari-web/test/mixins/common/kdc_credentials_controller_mixin_test.js
+++ b/ambari-web/test/mixins/common/kdc_credentials_controller_mixin_test.js
@@ -71,6 +71,19 @@ describe('App.KDCCredentialsControllerMixin', function() {
describe('#createKDCCredentials', function() {
+ function createConfig (name, value) {
+ return App.ServiceConfigProperty.create({
+ name: name,
+ value: value
+ });
+ }
+ function resolveWith (data) {
+ return $.Deferred().resolve(data).promise();
+ }
+ function rejectWith (data) {
+ return $.Deferred().reject(data).promise();
+ }
+
beforeEach(function () {
sinon.stub(App, 'get').withArgs('clusterName').returns('testName');
sinon.stub(credentialsUtils, 'createCredentials', function() {
@@ -90,18 +103,6 @@ describe('App.KDCCredentialsControllerMixin', function() {
credentialsUtils.updateCredentials.restore();
});
- var createConfig = function(name, value) {
- return App.ServiceConfigProperty.create({
- name: name,
- value: value
- });
- };
- var resolveWith = function(data) {
- return $.Deferred().resolve(data).promise();
- };
- var rejectWith = function(data) {
- return $.Deferred().reject(data).promise();
- };
[
{
configs: [
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/mixins/common/serverValidator_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mixins/common/serverValidator_test.js b/ambari-web/test/mixins/common/serverValidator_test.js
index e0fed81..c6d528a 100644
--- a/ambari-web/test/mixins/common/serverValidator_test.js
+++ b/ambari-web/test/mixins/common/serverValidator_test.js
@@ -33,14 +33,14 @@ describe('App.ServerValidatorMixin', function() {
};
var genResponse = function(items) {
return {
- items: (items.map(function(item) { return genRespItem.apply(undefined, item); }))
+ items: items.map(function(item) { return genRespItem.apply(undefined, item); })
};
};
var genConfigs = function(configs) {
return Em.Object.create({
- configs: (configs.map(function(item) {
+ configs: configs.map(function(item) {
return Em.Object.create({ name: item[0], filename: item[1] });
- }))
+ })
});
};
var tests = [
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/mixins/common/widget_mixin_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mixins/common/widget_mixin_test.js b/ambari-web/test/mixins/common/widget_mixin_test.js
index 72c7da8..e35f955 100644
--- a/ambari-web/test/mixins/common/widget_mixin_test.js
+++ b/ambari-web/test/mixins/common/widget_mixin_test.js
@@ -118,7 +118,7 @@ describe('App.WidgetMixin', function () {
});
it('HBASE_HBASE_REGIONSERVER', function () {
- var HBASE_HBASE_REGIONSERVER = {
+ var hbaseRegionServer = {
"name": "regionserver.Server.percentFilesLocal",
"service_name": "HBASE",
"component_name": "HBASE_REGIONSERVER",
@@ -137,11 +137,11 @@ describe('App.WidgetMixin', function () {
}
]
};
- expect(JSON.stringify(this.requestData['HBASE_HBASE_REGIONSERVER'])).to.equal(JSON.stringify(HBASE_HBASE_REGIONSERVER));
+ expect(JSON.stringify(this.requestData.HBASE_HBASE_REGIONSERVER)).to.equal(JSON.stringify(hbaseRegionServer));
});
it('HBASE_HBASE_REGIONSERVER_c1', function () {
- var HBASE_HBASE_REGIONSERVER_c1 = {
+ var hbaseRegionServerC1 = {
"name": "regionserver.Server.percentFilesLocal",
"service_name": "HBASE",
"component_name": "HBASE_REGIONSERVER",
@@ -155,11 +155,11 @@ describe('App.WidgetMixin', function () {
}
]
};
- expect(JSON.stringify(this.requestData['HBASE_HBASE_REGIONSERVER_c1'])).to.equal(JSON.stringify(HBASE_HBASE_REGIONSERVER_c1));
+ expect(JSON.stringify(this.requestData.HBASE_HBASE_REGIONSERVER_c1)).to.equal(JSON.stringify(hbaseRegionServerC1));
});
it('HDFS_DATANODE_c1', function () {
- var HDFS_DATANODE_c1 = {
+ var hdfsDataNodeC1 = {
"name": "regionserver.Server.percentFilesLocal",
"service_name": "HDFS",
"component_name": "DATANODE",
@@ -173,7 +173,7 @@ describe('App.WidgetMixin', function () {
}
]
};
- expect(JSON.stringify(this.requestData['HDFS_DATANODE_c1'])).to.equal(JSON.stringify(HDFS_DATANODE_c1));
+ expect(JSON.stringify(this.requestData.HDFS_DATANODE_c1)).to.equal(JSON.stringify(hdfsDataNodeC1));
});
});
@@ -484,29 +484,29 @@ describe('App.WidgetLoadAggregator', function () {
result = aggregator.groupRequests(requests);
});
- it("result['n1_C1'].subRequests.length", function () {
- expect(result['n1_C1'].subRequests.length).to.equal(1);
+ it("result.n1_C1.subRequests.length", function () {
+ expect(result.n1_C1.subRequests.length).to.equal(1);
});
- it("result['n1_C1'].data.metric_paths.length", function () {
- expect(result['n1_C1'].data.metric_paths.length).to.equal(1);
+ it("result.n1_C1.data.metric_paths.length", function () {
+ expect(result.n1_C1.data.metric_paths.length).to.equal(1);
});
- it("result['n1_C1_graph'].subRequests.length", function () {
- expect(result['n1_C1_graph'].subRequests.length).to.equal(1);
+ it("result.n1_C1_graph.subRequests.length", function () {
+ expect(result.n1_C1_graph.subRequests.length).to.equal(1);
});
- it("result['n1_C1_graph'].data.metric_paths.length", function () {
- expect(result['n1_C1_graph'].data.metric_paths.length).to.equal(1);
+ it("result.n1_C1_graph.data.metric_paths.length", function () {
+ expect(result.n1_C1_graph.data.metric_paths.length).to.equal(1);
});
- it("result['n2_C1'].subRequests.length", function () {
- expect(result['n2_C1'].subRequests.length).to.equal(1);
+ it("result.n2_C1.subRequests.length", function () {
+ expect(result.n2_C1.subRequests.length).to.equal(1);
});
- it("result['n2_C1'].data.metric_paths.length", function () {
- expect(result['n2_C1'].data.metric_paths.length).to.equal(1);
+ it("result.n2_C1.data.metric_paths.length", function () {
+ expect(result.n2_C1.data.metric_paths.length).to.equal(1);
});
- it("result['n1_C2'].subRequests.length", function () {
- expect(result['n1_C2'].subRequests.length).to.equal(1);
+ it("result.n1_C2.subRequests.length", function () {
+ expect(result.n1_C2.subRequests.length).to.equal(1);
});
- it("result['n1_C2'].data.metric_paths.length", function () {
- expect(result['n1_C2'].data.metric_paths.length).to.equal(1);
+ it("result.n1_C2.data.metric_paths.length", function () {
+ expect(result.n1_C2.data.metric_paths.length).to.equal(1);
});
});
@@ -541,7 +541,7 @@ describe('App.WidgetLoadAggregator', function () {
}
};
aggregator.runRequests(requests);
- expect(mock.f1.calledWith(requests['r1'].data)).to.be.true;
+ expect(mock.f1.calledWith(requests.r1.data)).to.be.true;
});
it("view destroyed", function () {
var requests = {
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/mixins/main/host/details/host_components/decommissionable_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mixins/main/host/details/host_components/decommissionable_test.js b/ambari-web/test/mixins/main/host/details/host_components/decommissionable_test.js
index fe89774..2d94d42 100644
--- a/ambari-web/test/mixins/main/host/details/host_components/decommissionable_test.js
+++ b/ambari-web/test/mixins/main/host/details/host_components/decommissionable_test.js
@@ -22,30 +22,6 @@ require('mixins/main/host/details/host_components/decommissionable');
var decommissionable,
view,
- statusCases = [
- {
- status: App.HostComponentStatus.started,
- expected: false
- },
- {
- status: 'status',
- expected: true
- }
- ],
- responseCases = [
- {
- HostRoles: {
- desired_admin_state: 'state'
- },
- ServiceComponentInfo: {component_state: ''}
- },
- {
- HostRoles: {
- desired_admin_state: null
- },
- ServiceComponentInfo: {component_state: ''}
- }
- ],
textCases = [
{
available: true,
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/mixins/main/service/configs/widget_popover_support_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mixins/main/service/configs/widget_popover_support_test.js b/ambari-web/test/mixins/main/service/configs/widget_popover_support_test.js
index 557ea91..449ff5d 100644
--- a/ambari-web/test/mixins/main/service/configs/widget_popover_support_test.js
+++ b/ambari-web/test/mixins/main/service/configs/widget_popover_support_test.js
@@ -16,14 +16,4 @@
* limitations under the License.
*/
-var App = require('app');
-var view;
-
-describe('App.WidgetPopoverSupport', function () {
-
- beforeEach(function () {
- view = Em.View.create(App.WidgetPopoverSupport, {});
- });
-
-
-});
\ No newline at end of file
+describe('App.WidgetPopoverSupport', function () {});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/mixins/wizard/wizardEnableDone_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mixins/wizard/wizardEnableDone_test.js b/ambari-web/test/mixins/wizard/wizardEnableDone_test.js
index 7969f54..9116da8 100644
--- a/ambari-web/test/mixins/wizard/wizardEnableDone_test.js
+++ b/ambari-web/test/mixins/wizard/wizardEnableDone_test.js
@@ -20,9 +20,7 @@ var App = require('app');
describe('App.WizardEnableDone', function () {
var baseObject = Em.Object.extend({
- statusChangeCallback: function (data) {
- isSubmitDisabled: true
- }
+ statusChangeCallback: function () {}
}),
mixedObject = baseObject.extend(App.WizardEnableDone),
mixedObjectInstance;
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/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 18a37cb..41d6a77 100644
--- a/ambari-web/test/mixins/wizard/wizardProgressPageController_test.js
+++ b/ambari-web/test/mixins/wizard/wizardProgressPageController_test.js
@@ -37,7 +37,7 @@ describe('App.wizardProgressPageControllerMixin', function() {
});
sinon.spy(mixedObjectInstance, 'onCreateComponent');
sinon.spy(mixedObjectInstance, 'updateComponent');
- sinon.stub(mixedObjectInstance, 'checkInstalledComponents', function(componentName, hostNames) {
+ sinon.stub(mixedObjectInstance, 'checkInstalledComponents', function(componentName) {
var def = $.Deferred();
var data = {
'ZOOKEEPER_SERVER': {
@@ -106,7 +106,7 @@ describe('App.wizardProgressPageControllerMixin', function() {
});
it('updateComponent is called', function () {
// invoke callback
- this.args.sender[this.args.success].apply(this.args.sender, [null, null, this.args.data]);
+ this.args.sender[this.args.success](null, null, this.args.data);
expect(mixedObjectInstance.updateComponent.called).to.be.true;
});
});
@@ -131,7 +131,7 @@ describe('App.wizardProgressPageControllerMixin', function() {
});
it('updateComponent is called', function () {
// invoke callback
- this.args.sender[this.args.success].apply(this.args.sender, [null, null, this.args.data]);
+ this.args.sender[this.args.success](null, null, this.args.data);
expect(mixedObjectInstance.updateComponent.called).to.be.true;
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/mock_data_setup/configs_mock_data.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mock_data_setup/configs_mock_data.js b/ambari-web/test/mock_data_setup/configs_mock_data.js
index 694862b..ae54235 100644
--- a/ambari-web/test/mock_data_setup/configs_mock_data.js
+++ b/ambari-web/test/mock_data_setup/configs_mock_data.js
@@ -107,15 +107,15 @@ module.exports = {
});
});
} else {
- for (var serviceName in configTags) {
- configTags[serviceName].forEach(function(tag) {
+ Object.keys(configTags).forEach(function (sName) {
+ configTags[sName].forEach(function(tag) {
configTagsObject.push({
siteName: tag,
tagName: "version1",
newTagName: null
});
});
- }
+ });
}
return configTagsObject.uniq();
},
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/models/authentication_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/models/authentication_test.js b/ambari-web/test/models/authentication_test.js
index f0002cd..ad825bd 100644
--- a/ambari-web/test/models/authentication_test.js
+++ b/ambari-web/test/models/authentication_test.js
@@ -53,12 +53,12 @@ describe('App.AuthenticationForm', function () {
methods.forEach(function (method) {
method.fields.forEach(function (field) {
describe('#' + field + '.isRequired', function () {
- for (var i = 2; i--; ) {
+ [2, 1, 0].forEach(function (i) {
it('should be ' + i + ' dependent on ' + method.name + ' value', function () {
form.getField(method.name).set('value', i);
expect(form.getField(field).get('isRequired')).to.equal(i);
});
- }
+ });
});
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/models/configs/objects/service_config_property_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/models/configs/objects/service_config_property_test.js b/ambari-web/test/models/configs/objects/service_config_property_test.js
index 7164602..2b4a297 100644
--- a/ambari-web/test/models/configs/objects/service_config_property_test.js
+++ b/ambari-web/test/models/configs/objects/service_config_property_test.js
@@ -54,56 +54,6 @@ var serviceConfigProperty,
})
],
- components = [
- {
- name: 'NameNode',
- master: true
- },
- {
- name: 'SNameNode',
- master: true
- },
- {
- name: 'JobTracker',
- master: true
- },
- {
- name: 'HBase Master',
- master: true
- },
- {
- name: 'Oozie Master',
- master: true
- },
- {
- name: 'Hive Metastore',
- master: true
- },
- {
- name: 'WebHCat Server',
- master: true
- },
- {
- name: 'ZooKeeper Server',
- master: true
- },
- {
- name: 'Ganglia',
- master: true
- },
- {
- name: 'DataNode',
- slave: true
- },
- {
- name: 'TaskTracker',
- slave: true
- },
- {
- name: 'RegionServer',
- slave: true
- }
- ],
overridableFalseData = [
{
isOverridable: false
@@ -120,7 +70,8 @@ var serviceConfigProperty,
{
isOverridable: true,
isEditable: true
- }, {
+ },
+ {
isOverridable: true,
overrides: []
},
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/models/configs/objects/service_config_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/models/configs/objects/service_config_test.js b/ambari-web/test/models/configs/objects/service_config_test.js
index b3e8122..8a757ea 100644
--- a/ambari-web/test/models/configs/objects/service_config_test.js
+++ b/ambari-web/test/models/configs/objects/service_config_test.js
@@ -21,7 +21,6 @@ var App = require('app');
require('models/configs/objects/service_config');
var serviceConfig,
- group,
configs = [
Em.Object.create({
'name': 'p1',
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/models/configs/theme/tab_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/models/configs/theme/tab_test.js b/ambari-web/test/models/configs/theme/tab_test.js
index 813d997..3a5f21d 100644
--- a/ambari-web/test/models/configs/theme/tab_test.js
+++ b/ambari-web/test/models/configs/theme/tab_test.js
@@ -17,7 +17,6 @@
*/
var App = require('app');
-var model;
function getModel() {
return App.Tab.createRecord();
@@ -25,10 +24,6 @@ function getModel() {
describe('App.Tab', function () {
- beforeEach(function () {
- model = getModel();
- });
-
App.TestAliases.testAsComputedSumBy(getModel(), 'errorsCount', 'sections', 'errorsCount');
App.TestAliases.testAsComputedIfThenElse(getModel(), 'tooltipMsg', 'isHiddenByFilter', Em.I18n.t('services.service.config.nothing.to.display') , '');
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/models/form_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/models/form_test.js b/ambari-web/test/models/form_test.js
index 18c86c6..29ca459 100644
--- a/ambari-web/test/models/form_test.js
+++ b/ambari-web/test/models/form_test.js
@@ -194,6 +194,7 @@ describe('App.FormField', function () {
});
});
+ /*eslint-disable mocha-cleanup/asserts-limit */
describe('#validate', function () {
it('should return error message', function () {
formField.set('isRequired', true);
@@ -206,6 +207,7 @@ describe('App.FormField', function () {
expectError('');
});
});
+ /*eslint-enable mocha-cleanup/asserts-limit */
describe('#isHiddenField', function () {
hiddenCases.forEach(function (item) {
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/models/host_component_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/models/host_component_test.js b/ambari-web/test/models/host_component_test.js
index 4266c3c..92e3d50 100644
--- a/ambari-web/test/models/host_component_test.js
+++ b/ambari-web/test/models/host_component_test.js
@@ -225,10 +225,10 @@ describe('App.HostComponent', function() {
}
];
- it('reset statusClass to plain property', function () {
+ beforeEach(function () {
hc.reopen({
statusClass: ''
- })
+ });
});
testCases.forEach(function (test) {
it('statusClass - ' + test.statusClass, function () {
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/models/host_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/models/host_test.js b/ambari-web/test/models/host_test.js
index cbeca12..37092da 100644
--- a/ambari-web/test/models/host_test.js
+++ b/ambari-web/test/models/host_test.js
@@ -463,11 +463,12 @@ describe('App.Host', function () {
}
];
- it('reset healthClass to plain property', function(){
+ beforeEach(function() {
host1.reopen({
healthClass: ''
});
});
+
testCases.forEach(function (test) {
it('healthClass - ' + test.params.healthClass, function () {
host1.set('healthClass', test.params.healthClass);
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/models/service/hdfs_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/models/service/hdfs_test.js b/ambari-web/test/models/service/hdfs_test.js
index 2eb1130..9f69dd0 100644
--- a/ambari-web/test/models/service/hdfs_test.js
+++ b/ambari-web/test/models/service/hdfs_test.js
@@ -18,7 +18,6 @@
var App = require('app');
-var modelSetup = require('test/init_model_test');
require('models/service/hdfs');
describe('App.HDFSService', function () {
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/models/service/yarn_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/models/service/yarn_test.js b/ambari-web/test/models/service/yarn_test.js
index 9670092..55e1452 100644
--- a/ambari-web/test/models/service/yarn_test.js
+++ b/ambari-web/test/models/service/yarn_test.js
@@ -25,29 +25,6 @@ var yarnService,
yarnServiceData = {
id: 'yarn'
},
- hostComponentsData = [
- {
- id: 'ats',
- componentName: 'APP_TIMELINE_SERVER',
- host: {
- id: 'host'
- }
- },
- {
- id: 'nodemanager',
- componentName: 'NODEMANAGER',
- host: {
- id: 'host'
- }
- },
- {
- id: 'yarnclient',
- componentName: 'YARN_CLIENT',
- host: {
- id: 'host'
- }
- }
- ],
configs = [
{
properties: {
@@ -56,38 +33,7 @@ var yarnService,
tag: 'version2',
type: 'yarn-site'
}
- ],
- nodeCountCases = [
- {
- assets: {
- nodeManagersStarted: 0,
- nodeManagersInstalled: 1,
- nodeManagersTotal: 1,
- nodeManagersCountActive: 0,
- nodeManagersCountRebooted: 0,
- nodeManagersCountUnhealthy: 0,
- nodeManagersCountDecommissioned: 0
- },
- nodeManagersCountLost: 1
- },
- {
- assets: {
- nodeManagersStarted: 1,
- nodeManagersInstalled: 1,
- nodeManagersTotal: 1,
- nodeManagersCountActive: 1,
- nodeManagersCountRebooted: 1,
- nodeManagersCountUnhealthy: 0,
- nodeManagersCountDecommissioned: 0
- },
- nodeManagersCountLost: 0
- }
- ],
- setHostComponents = function () {
- yarnService.reopen({
- hostComponents: hostComponentsData
- });
- };
+ ];
describe('App.YARNService', function () {
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/models/service_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/models/service_test.js b/ambari-web/test/models/service_test.js
index eeb0de0..8643f5d 100644
--- a/ambari-web/test/models/service_test.js
+++ b/ambari-web/test/models/service_test.js
@@ -61,72 +61,6 @@ var service,
property: 'isStarted'
}
],
- services = [
- {
- name: 'HDFS',
- configurable: true
- },
- {
- name: 'YARN',
- configurable: true
- },
- {
- name: 'MAPREDUCE2',
- configurable: true
- },
- {
- name:'TEZ',
- clientOnly: true,
- configurable: true
- },
- {
- name: 'HBASE',
- configurable: true
- },
- {
- name: 'HIVE',
- configurable: true
- },
- {
- name: 'FLUME',
- configurable: true
- },
- {
- name: 'FALCON',
- configurable: true
- },
- {
- name: 'STORM',
- configurable: true
- },
- {
- name: 'OOZIE',
- configurable: true
- },
- {
- name: 'GANGLIA',
- configurable: true
- },
- {
- name: 'ZOOKEEPER',
- configurable: true
- },
- {
- name: 'PIG',
- configurable: true,
- clientOnly: true
- },
- {
- name: 'SQOOP',
- clientOnly: true
- },
- {
- name: 'HUE',
- configurable: true
- }
- ],
- clientsOnly = services.filterProperty('clientOnly').mapProperty('name'),
- configurable = services.filterProperty('configurable').mapProperty('name'),
hostComponentsDataFalse = [
[],
[
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/models/stack_version/repository_version_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/models/stack_version/repository_version_test.js b/ambari-web/test/models/stack_version/repository_version_test.js
index 7ec1bf4..bbb98a3 100644
--- a/ambari-web/test/models/stack_version/repository_version_test.js
+++ b/ambari-web/test/models/stack_version/repository_version_test.js
@@ -42,19 +42,22 @@ describe('App.RepositoryVersion', function () {
before(function () {
sinon.stub(App, 'get').returns(['host1']);
});
+
+ beforeEach(function () {
+ model = getModel();
+ });
+
after(function () {
App.get.restore();
});
it("stackVersion is null", function() {
- var model = getModel();
model.set('stackVersion', null);
model.propertyDidChange('notInstalledHosts');
expect(model.get('notInstalledHosts')).to.eql(['host1']);
});
it("stackVersion has notInstalledHosts array", function() {
- var model = getModel();
model.set('stackVersion', Em.Object.create({
notInstalledHosts: ['host2']
}));
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/router_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/router_test.js b/ambari-web/test/router_test.js
index 78540e7..cf638d9 100644
--- a/ambari-web/test/router_test.js
+++ b/ambari-web/test/router_test.js
@@ -450,7 +450,6 @@ describe('App.Router', function () {
});
describe("#getAuthenticated", function() {
- var router;
beforeEach(function () {
router = App.Router.create();
this.mockGetCurrentLocationUrl = sinon.stub(router, 'getCurrentLocationUrl');
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/routes/views_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/routes/views_test.js b/ambari-web/test/routes/views_test.js
index b5c5cf7..19dc343 100644
--- a/ambari-web/test/routes/views_test.js
+++ b/ambari-web/test/routes/views_test.js
@@ -23,7 +23,7 @@ describe('routes/views', function() {
var route = routeClass.create().get('viewDetails').create();
describe("#parseViewPath", function() {
- var testCases = [
+ [
{
url: 'viewName',
result: ''
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/utils/batch_scheduled_requests_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/utils/batch_scheduled_requests_test.js b/ambari-web/test/utils/batch_scheduled_requests_test.js
index 11ba710..f564824 100644
--- a/ambari-web/test/utils/batch_scheduled_requests_test.js
+++ b/ambari-web/test/utils/batch_scheduled_requests_test.js
@@ -99,8 +99,9 @@ describe('batch_scheduled_requests', function() {
sinon.spy(batchUtils, 'showRollingRestartPopup');
sinon.spy(batchUtils, 'showWarningRollingRestartPopup');
sinon.stub(App, 'get', function(k) {
- if ('components.rollinRestartAllowed' === k)
+ if ('components.rollinRestartAllowed' === k) {
return ['DATANODE', 'TASKTRACKER', 'NODEMANAGER', 'HBASE_REGIONSERVER', 'SUPERVISOR'];
+ }
return Em.get(App, k);
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/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 bda0b58..6337293 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.eql('c1');
+ expect(map.h2[0]).to.eql('c1');
});
it('skip generations as hosts is empty', function() {
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/utils/config_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/utils/config_test.js b/ambari-web/test/utils/config_test.js
index c88c745..13e0fa5 100644
--- a/ambari-web/test/utils/config_test.js
+++ b/ambari-web/test/utils/config_test.js
@@ -22,7 +22,6 @@ require('utils/configs_collection');
require('utils/config');
require('models/service/hdfs');
var setups = require('test/init_model_test');
-var modelSetup = setups.configs;
function dummyCopy(val) {
return JSON.parse(JSON.stringify(val));
@@ -59,7 +58,7 @@ describe('App.config', function () {
describe('two configs into textarea', function () {
var result;
beforeEach(function () {
- result = App.config.fileConfigsIntoTextarea.call(App.config, configs, filename);
+ result = App.config.fileConfigsIntoTextarea(configs, filename);
});
it('One config is returned', function () {
expect(result.length).to.equal(1);
@@ -77,7 +76,7 @@ describe('App.config', function () {
newConfigs.push(dummyCopy(c3));
var result;
beforeEach(function () {
- result = App.config.fileConfigsIntoTextarea.call(App.config, newConfigs, filename);
+ result = App.config.fileConfigsIntoTextarea(newConfigs, filename);
});
it('One config is returned', function () {
expect(result.length).to.equal(1);
@@ -97,7 +96,7 @@ describe('App.config', function () {
var result;
beforeEach(function () {
- result = App.config.fileConfigsIntoTextarea.call(App.config, newConfigs, filename);
+ result = App.config.fileConfigsIntoTextarea(newConfigs, filename);
});
it('Two configs are returned', function () {
@@ -115,7 +114,7 @@ describe('App.config', function () {
describe('none configs into empty textarea', function () {
var result;
beforeEach(function () {
- result = App.config.fileConfigsIntoTextarea.call(App.config, [], 'capacity-scheduler.xml');
+ result = App.config.fileConfigsIntoTextarea([], 'capacity-scheduler.xml');
});
it('One config is returned', function () {
expect(result.length).to.equal(1);
@@ -136,7 +135,7 @@ describe('App.config', function () {
newConfigs.push(dummyCopy(c3));
var result;
beforeEach(function () {
- result = App.config.fileConfigsIntoTextarea.call(App.config, newConfigs, 'capacity-scheduler.xml', [c3]);
+ result = App.config.fileConfigsIntoTextarea(newConfigs, 'capacity-scheduler.xml', [c3]);
});
it('Two configs are returned', function () {
expect(result.length).to.equal(2);
@@ -194,7 +193,7 @@ describe('App.config', function () {
describe('config1=value1 to one config', function () {
var result;
beforeEach(function () {
- result = App.config.textareaIntoFileConfigs.call(App.config, testData[0].configs, filename);
+ result = App.config.textareaIntoFileConfigs(testData[0].configs, filename);
});
it('One config is returned', function () {
expect(result.length).to.equal(1);
@@ -213,7 +212,7 @@ describe('App.config', function () {
describe('config1=value1\\nconfig2=value2\\n to two configs', function () {
var result;
beforeEach(function () {
- result = App.config.textareaIntoFileConfigs.call(App.config, testData[1].configs, filename);
+ result = App.config.textareaIntoFileConfigs(testData[1].configs, filename);
});
it('Two configs are returned', function (){
expect(result.length).to.equal(2);
@@ -241,7 +240,7 @@ describe('App.config', function () {
describe('config1=value1,value2\n to one config', function () {
var result;
beforeEach(function () {
- result = App.config.textareaIntoFileConfigs.call(App.config, testData[2].configs, filename);
+ result = App.config.textareaIntoFileConfigs(testData[2].configs, filename);
});
it('One config is returned', function () {
expect(result.length).to.equal(1);
@@ -260,7 +259,7 @@ describe('App.config', function () {
describe('config1=value1 config2=value2 to two configs', function () {
var result;
beforeEach(function () {
- result = App.config.textareaIntoFileConfigs.call(App.config, testData[3].configs, filename);
+ result = App.config.textareaIntoFileConfigs(testData[3].configs, filename);
});
it('One config is returned', function () {
expect(result.length).to.equal(1);
@@ -676,9 +675,9 @@ describe('App.config', function () {
it('creates override with save properties as original config', function() {
var override = App.config.createOverride(configProperty, {}, group);
- for (var key in template) {
+ Object.keys(template).forEach(function (key) {
expect(override.get(key)).to.eql(template[key]);
- }
+ });
});
describe('overrides some values that should be different for override', function() {
@@ -711,9 +710,9 @@ describe('App.config', function () {
};
var override = App.config.createOverride(configProperty, overridenTemplate, group);
- for (var key in overridenTemplate) {
+ Object.keys(overridenTemplate).forEach(function (key) {
expect(override.get(key)).to.eql(overridenTemplate[key]);
- }
+ });
});
it('throws error due to undefined configGroup', function() {
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/utils/configs/config_initializer_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/utils/configs/config_initializer_test.js b/ambari-web/test/utils/configs/config_initializer_test.js
index f8eb825..32f8b14 100644
--- a/ambari-web/test/utils/configs/config_initializer_test.js
+++ b/ambari-web/test/utils/configs/config_initializer_test.js
@@ -21,62 +21,7 @@ var App = require('app');
require('models/configs/objects/service_config_property');
require('utils/configs/config_initializer');
-var serviceConfig,
- group,
- serviceConfigProperty,
-
- components = [
- {
- name: 'NameNode',
- master: true
- },
- {
- name: 'SNameNode',
- master: true
- },
- {
- name: 'JobTracker',
- master: true
- },
- {
- name: 'HBase Master',
- master: true
- },
- {
- name: 'Oozie Master',
- master: true
- },
- {
- name: 'Hive Metastore',
- master: true
- },
- {
- name: 'WebHCat Server',
- master: true
- },
- {
- name: 'ZooKeeper Server',
- master: true
- },
- {
- name: 'Ganglia',
- master: true
- },
- {
- name: 'DataNode',
- slave: true
- },
- {
- name: 'TaskTracker',
- slave: true
- },
- {
- name: 'RegionServer',
- slave: true
- }
- ],
- masters = components.filterProperty('master'),
- slaves = components.filterProperty('slave');
+var serviceConfigProperty;
describe('App.ConfigInitializer', function () {
@@ -357,7 +302,7 @@ describe('App.ConfigInitializer', function () {
App.get.restore();
});
- cases['hive_database'].forEach(function (item) {
+ cases.hive_database.forEach(function (item) {
var title = 'hive_database value should be set to {0}';
describe(title.format(item.value), function () {
@@ -410,10 +355,10 @@ describe('App.ConfigInitializer', function () {
});
});
- it(cases['hive_master_hosts'].title, function () {
+ it(cases.hive_master_hosts.title, function () {
serviceConfigProperty.set('name', 'hive_master_hosts');
- App.ConfigInitializer.initialValue(serviceConfigProperty, cases['hive_master_hosts'].localDB, []);
- expect(serviceConfigProperty.get('value')).to.equal(cases['hive_master_hosts'].value);
+ App.ConfigInitializer.initialValue(serviceConfigProperty, cases.hive_master_hosts.localDB, []);
+ expect(serviceConfigProperty.get('value')).to.equal(cases.hive_master_hosts.value);
});
it(cases['hive.metastore.uris'].title, function () {
@@ -432,7 +377,7 @@ describe('App.ConfigInitializer', function () {
recommendedValue: cases['templeton.hive.properties'].recommendedValue,
value: cases['templeton.hive.properties'].recommendedValue
});
- App.ConfigInitializer.initialValue(serviceConfigProperty, cases['templeton.hive.properties'].localDB, {'hive.metastore.uris': cases['templeton.hive.properties'].recommendedValue});
+ App.ConfigInitializer.initialValue(serviceConfigProperty, cases['templeton.hive.properties'].localDB, {'hive.metastore.uris': cases['templeton.hive.properties'].recommendedValue});
expect(serviceConfigProperty.get('value')).to.equal(cases['templeton.hive.properties'].value);
expect(serviceConfigProperty.get('recommendedValue')).to.equal(cases['templeton.hive.properties'].value);
});
@@ -442,7 +387,7 @@ describe('App.ConfigInitializer', function () {
name: 'yarn.resourcemanager.zk-address',
recommendedValue: cases['yarn.resourcemanager.zk-address'].recommendedValue
});
- App.ConfigInitializer.initialValue(serviceConfigProperty, cases['yarn.resourcemanager.zk-address'].localDB, cases['yarn.resourcemanager.zk-address'].dependencies);
+ App.ConfigInitializer.initialValue(serviceConfigProperty, cases['yarn.resourcemanager.zk-address'].localDB, cases['yarn.resourcemanager.zk-address'].dependencies);
expect(serviceConfigProperty.get('value')).to.equal(cases['yarn.resourcemanager.zk-address'].value);
expect(serviceConfigProperty.get('recommendedValue')).to.equal(cases['yarn.resourcemanager.zk-address'].value);
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/utils/configs/database_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/utils/configs/database_test.js b/ambari-web/test/utils/configs/database_test.js
index e5f9d26..05f21de 100644
--- a/ambari-web/test/utils/configs/database_test.js
+++ b/ambari-web/test/utils/configs/database_test.js
@@ -16,7 +16,6 @@
* limitations under the License.
*/
-var App = require('app');
var dbUtils = require('utils/configs/database');
describe('Database Utils', function() {
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/utils/data_manipulation_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/utils/data_manipulation_test.js b/ambari-web/test/utils/data_manipulation_test.js
index fec5625..50eb6b5 100644
--- a/ambari-web/test/utils/data_manipulation_test.js
+++ b/ambari-web/test/utils/data_manipulation_test.js
@@ -16,9 +16,9 @@
* limitations under the License.
*/
-var data_manipulation = require('utils/data_manipulation');
+var dataManipulation = require('utils/data_manipulation');
-describe('data_manipulation', function () {
+describe('dataManipulation', function () {
describe('#rejectPropertyValues', function () {
@@ -31,7 +31,7 @@ describe('data_manipulation', function () {
],
key = 'n',
valuesToReject = ['v2', 'v3'];
- var result = data_manipulation.rejectPropertyValues(collection, key, valuesToReject);
+ var result = dataManipulation.rejectPropertyValues(collection, key, valuesToReject);
expect(result).to.eql([
{n: 'v1'},
{n: 'v4'}
@@ -51,7 +51,7 @@ describe('data_manipulation', function () {
],
key = 'n',
valuesToFilter = ['v2', 'v3'];
- var result = data_manipulation.filterPropertyValues(collection, key, valuesToFilter);
+ var result = dataManipulation.filterPropertyValues(collection, key, valuesToFilter);
expect(result).to.eql([
{n: 'v2'},
{n: 'v3'}
@@ -70,7 +70,7 @@ describe('data_manipulation', function () {
{n: 'v4'}
],
key = 'n';
- var result = data_manipulation.groupPropertyValues(collection, key);
+ var result = dataManipulation.groupPropertyValues(collection, key);
expect(JSON.stringify(result)).to.equal(JSON.stringify({
v1: [
{n: 'v1'}
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/utils/date/date_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/utils/date/date_test.js b/ambari-web/test/utils/date/date_test.js
index 1ccfb31..3d61c90 100644
--- a/ambari-web/test/utils/date/date_test.js
+++ b/ambari-web/test/utils/date/date_test.js
@@ -16,21 +16,12 @@
* limitations under the License.
*/
-var Ember = require('ember');
var App = require('app');
-
-var validator = require('utils/validator');
var date = require('utils/date/date');
describe('date', function () {
- var correct_tests = Em.A([
- {t: 1349752195000, e: 'Tue, Oct 09, 2012 03:09', e2: 'Tue Oct 09 2012'},
- {t: 1367752195000, e: 'Sun, May 05, 2013 11:09', e2: 'Sun May 05 2013'},
- {t: 1369952195000, e: 'Thu, May 30, 2013 22:16', e2: 'Thu May 30 2013'}
- ]);
-
- var incorrect_tests = Em.A([
+ var incorrectTests = Em.A([
{t: null},
{t: ''},
{t: false},
@@ -104,7 +95,7 @@ describe('date', function () {
});
describe('Incorrect data', function(){
- incorrect_tests.forEach(function(test) {
+ incorrectTests.forEach(function(test) {
it(test.t, function() {
expect(date.timingFormat(test.t)).to.equal(null);
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/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 910cc9f..7d78678 100644
--- a/ambari-web/test/utils/helper_test.js
+++ b/ambari-web/test/utils/helper_test.js
@@ -181,8 +181,9 @@ describe('utils/helper', function() {
});
it('should sort array', function() {
result.forEach(function(resultObj, index, resultArr) {
- if (index > resultArr.length - 1)
+ if (index > resultArr.length - 1) {
expect(resultObj.a < resultArr[index + 1].a).to.eql(false);
+ }
});
});
it('should try to sort without throwing exception', function(){
@@ -244,7 +245,7 @@ describe('utils/helper', function() {
beforeEach(appendDiv);
afterEach(removeDiv);
it('should add tooltip', function() {
- var tooltip = App.tooltip($('#tooltip-test'));
+ App.tooltip($('#tooltip-test'));
expect($('#tooltip-test').data('tooltip').enabled).to.eql(true);
});
});
@@ -252,7 +253,7 @@ describe('utils/helper', function() {
beforeEach(appendDiv);
afterEach(removeDiv);
it('should add popover', function() {
- var tooltip = App.popover($('#tooltip-test'));
+ App.popover($('#tooltip-test'));
expect($('#tooltip-test').data('popover').enabled).to.eql(true);
});
});
@@ -304,13 +305,11 @@ describe('utils/helper', function() {
'FALCON': 'Falcon',
'falcon': 'Falcon'
};
- for (var inputName in tests) {
- (function(name) {
- it(testMessage.format(name, tests[name]), function() {
- expect(App.format.normalizeNameBySeparators(name, ["-", "_", " "])).to.eql(tests[name]);
- });
- })(inputName)
- }
+ Object.keys(tests).forEach(function (inputName) {
+ it(testMessage.format(inputName, tests[inputName]), function() {
+ expect(App.format.normalizeNameBySeparators(inputName, ["-", "_", " "])).to.eql(tests[inputName]);
+ });
+ });
});
describe('#normalizeName()', function() {
@@ -386,13 +385,11 @@ describe('utils/helper', function() {
'ZOOKEEPER_SERVICE_CHECK': 'ZooKeeper Service Check',
'CLIENT': 'Client'
};
- for (var inputName in tests) {
- (function(name) {
- it(testMessage.format(name, tests[name]), function() {
- expect(App.format.normalizeName(name)).to.eql(tests[name]);
- });
- })(inputName)
- }
+ Object.keys(tests).forEach(function (inputName) {
+ it(testMessage.format(inputName, tests[inputName]), function() {
+ expect(App.format.normalizeName(inputName)).to.eql(tests[inputName]);
+ });
+ });
});
describe('#kdcErrorMsg()', function() {
var tests = [
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/utils/host_progress_popup_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/utils/host_progress_popup_test.js b/ambari-web/test/utils/host_progress_popup_test.js
index 8ef64d2..1d143a7 100644
--- a/ambari-web/test/utils/host_progress_popup_test.js
+++ b/ambari-web/test/utils/host_progress_popup_test.js
@@ -26,76 +26,7 @@ require('utils/host_progress_popup');
describe('App.HostPopup', function () {
- var services = [
- {
- displayName: "Start service WebHCat",
- hosts: [
- {
- logTasks: [
- {
- Tasks: {
- command: "START",
- host_name: "ip-10-12-123-90.ec2.internal",
- role: "WEBHCAT_SERVER",
- status: "QUEUED"
- },
- href: "http://ec2-54-224-233-43.compute-1.amazonaws.com:8080/api/v1/clusters/mycluster/requests/23/tasks/94"
- }
- ],
- name: "ip-10-12-123-90.ec2.internal",
- publicName: "ip-10-12-123-90.ec2.internal",
- serviceName: "Start service WebHCat"
- }
- ],
- isRunning: false
- },
- {
- displayName: "Start service Hive/HCat",
- hosts: [
- {
- logTasks: [
- {
- Tasks: {
- command: "INSTALL",
- host_name: "ip-10-12-123-90.ec2.internal",
- status: "COMPLETED"
- },
- href: "http://ec2-54-224-233-43.compute-1.amazonaws.com:8080/api/v1/clusters/mycluster/requests/15/tasks/76"
- }
- ],
- name: "ip-10-12-123-90.ec2.internal",
- publicName: "ip-10-12-123-90.ec2.internal",
- serviceName: "Start service Hive/HCat"
- },
- {
- logTasks: [
- {
- Tasks: {
- command: "START",
- host_name: "ip-10-33-7-23.ec2.internal",
- status: "COMPLETED"
- },
- href: "http://ec2-54-224-233-43.compute-1.amazonaws.com:8080/api/v1/clusters/mycluster/requests/15/tasks/78"
- },
- {
- Tasks: {
- command: "START",
- host_name: "ip-10-33-7-23.ec2.internal",
- status: "COMPLETED"
- },
- href: "http://ec2-54-224-233-43.compute-1.amazonaws.com:8080/api/v1/clusters/mycluster/requests/15/tasks/79"
- }
- ],
- name: "ip-10-33-7-23.ec2.internal",
- publicName: "ip-10-33-7-23.ec2.internal",
- serviceName: "Start service Hive/HCat"
- }
- ],
- isRunning: false
- }
- ];
-
- var test_tasks = [
+ var testTasks = [
{
t: [
{
@@ -346,17 +277,17 @@ describe('App.HostPopup', function () {
});
describe('#getStatus', function() {
- test_tasks.forEach(function(test_task) {
- it(test_task.m, function() {
- expect(App.HostPopup.getStatus(test_task.t)[0]).to.equal(test_task.r);
+ testTasks.forEach(function(testTask) {
+ it(testTask.m, function() {
+ expect(App.HostPopup.getStatus(testTask.t)[0]).to.equal(testTask.r);
});
});
});
describe('#getProgress', function() {
- test_tasks.forEach(function(test_task) {
- it(test_task.m, function() {
- expect(App.HostPopup.getProgress(test_task.t)).to.equal(test_task.p);
+ testTasks.forEach(function(testTask) {
+ it(testTask.m, function() {
+ expect(App.HostPopup.getProgress(testTask.t)).to.equal(testTask.p);
});
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/utils/load_timer_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/utils/load_timer_test.js b/ambari-web/test/utils/load_timer_test.js
index 4e84134..8005ff0 100644
--- a/ambari-web/test/utils/load_timer_test.js
+++ b/ambari-web/test/utils/load_timer_test.js
@@ -16,8 +16,6 @@
* limitations under the License.
*/
-var misc = require('utils/load_timer');
-
describe('App.loadTimer', function () {
window.performance = {
@@ -38,7 +36,7 @@ describe('App.loadTimer', function () {
describe("#start()", function() {
it("time should be cached", function() {
App.loadTimer.start('test');
- expect(App.loadTimer.get('timeStampCache')['test']).to.be.an('number');
+ expect(App.loadTimer.get('timeStampCache.test')).to.be.an('number');
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/utils/misc_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/utils/misc_test.js b/ambari-web/test/utils/misc_test.js
index c54df7e3..432459e 100644
--- a/ambari-web/test/utils/misc_test.js
+++ b/ambari-web/test/utils/misc_test.js
@@ -36,7 +36,7 @@ describe('misc', function () {
expect(misc.formatBandwidth(test.i)).to.equal(test.e);
});
});
- it('NaN to NaN' + ' ', function () {
+ it('NaN to NaN', function () {
expect(isNaN(misc.formatBandwidth(NaN))).to.equal(true);
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/40aac602/ambari-web/test/utils/number_utils_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/utils/number_utils_test.js b/ambari-web/test/utils/number_utils_test.js
index 513fc6a..952ab89 100644
--- a/ambari-web/test/utils/number_utils_test.js
+++ b/ambari-web/test/utils/number_utils_test.js
@@ -268,7 +268,7 @@ describe('utils/number_utils', function() {
];
var message = 'cardinality `{0}`. {1} value should be {2}';
tests.forEach(function(test) {
- it(message.format('' + test.cardinality, (test.isMax ? 'maximum' : 'minimum'), test.e), function() {
+ it(message.format('' + test.cardinality, test.isMax ? 'maximum' : 'minimum', test.e), function() {
expect(numberUtils.getCardinalityValue(test.cardinality, test.isMax)).to.be.eql(test.e);
});
})