Repository: ambari
Updated Branches:
  refs/heads/trunk bc841dce6 -> f8213edb4


http://git-wip-us.apache.org/repos/asf/ambari/blob/f8213edb/ambari-web/test/mappers/configs/themes_mapper_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/mappers/configs/themes_mapper_test.js 
b/ambari-web/test/mappers/configs/themes_mapper_test.js
index a958335..bc25d1d 100644
--- a/ambari-web/test/mappers/configs/themes_mapper_test.js
+++ b/ambari-web/test/mappers/configs/themes_mapper_test.js
@@ -92,45 +92,45 @@ describe('App.themeMapper', function () {
                     }
                   ],
                   "widgets": [
-                              {
-                                "config": "c1/p1",
-                                "widget": {
-                                  "type": "slider",
-                                  "units": [
-                                            {
-                                              "unit-name": "MB"
-                                            },
-                                            {
-                                              "unit-name": "GB"
-                                            }
-                                            ]
-                                }
-                              },
-                              {
-                                "config": "c1/p2",
-                                "widget": {
-                                  "type": "slider",
-                                  "units": [
-                                            {
-                                              "unit-name": "percent"
-                                            }
-                                            ]
-                                }
-                              }
-                              ],
-                              "placement": {
-                                "configuration-layout": "default",
-                                "configs": [
-                                            {
-                                              "config": "c1/p1",
-                                              "subsection-name": "subsection1"
-                                            },
-                                            {
-                                              "config": "c1/p2",
-                                              "subsection-name": "subsection1"
-                                            }
-                                            ]
-                              }
+                    {
+                      "config": "c1/p1",
+                      "widget": {
+                        "type": "slider",
+                        "units": [
+                          {
+                            "unit-name": "MB"
+                          },
+                          {
+                            "unit-name": "GB"
+                          }
+                        ]
+                      }
+                    },
+                    {
+                      "config": "c1/p2",
+                      "widget": {
+                        "type": "slider",
+                        "units": [
+                          {
+                            "unit-name": "percent"
+                          }
+                        ]
+                      }
+                    }
+                  ],
+                  "placement": {
+                    "configuration-layout": "default",
+                    "configs": [
+                      {
+                        "config": "c1/p1",
+                        "subsection-name": "subsection1"
+                      },
+                      {
+                        "config": "c1/p2",
+                        "subsection-name": "subsection1"
+                      }
+                    ]
+                  }
                 }
               }
             }
@@ -139,56 +139,72 @@ describe('App.themeMapper', function () {
       ]
     };
 
-    it('should map theme data', function () {
+    describe('should map theme data', function () {
 
-      App.themesMapper.map(json);
+      beforeEach(function () {
+        App.themesMapper.map(json);
+      });
 
-      expect(App.Tab.find().get('length')).to.equal(1);
-      expect(App.Section.find().get('length')).to.equal(2);
-      expect(App.SubSection.find().get('length')).to.equal(1);
+      it('1 Tab is mapped', function () {
+        expect(App.Tab.find().get('length')).to.equal(1);
+      });
 
-      //checking tab
-      expect(App.Tab.find('HDFS_settings').toJSON()).to.eql({
-        id: 'HDFS_settings',
-        name: 'settings',
-        display_name: 'Settings',
-        columns: "2",
-        rows: "1",
-        is_advanced: false,
-        service_name: 'HDFS',
-        is_advanced_hidden: false,
-        is_rendered: false,
-        is_configs_prepared: false
+      it('2 Sections are mapped', function () {
+        expect(App.Section.find().get('length')).to.equal(2);
+      });
+
+      it('1 SubSection is mapped', function () {
+        expect(App.SubSection.find().get('length')).to.equal(1);
+      });
+
+      it('HDFS_settings tab is mapped correctly', function () {
+        //checking tab
+        expect(App.Tab.find('HDFS_settings').toJSON()).to.eql({
+          id: 'HDFS_settings',
+          name: 'settings',
+          display_name: 'Settings',
+          columns: "2",
+          rows: "1",
+          is_advanced: false,
+          service_name: 'HDFS',
+          is_advanced_hidden: false,
+          is_rendered: false,
+          is_configs_prepared: false
+        });
       });
 
-      //checking section
-      
expect(App.Tab.find('HDFS_settings').get('sections').objectAt(0).toJSON()).to.eql({
-        "id": "Section-1",
-        "name": "Section-1",
-        "display_name": "Section One",
-        "row_index": "0",
-        "row_span": "1",
-        "column_index": "0",
-        "column_span": "1",
-        "section_columns": "2",
-        "section_rows": "3",
-        "tab_id": "HDFS_settings"
+      it('HDFS_settings section is mapped correctly', function () {
+        //checking section
+        
expect(App.Tab.find('HDFS_settings').get('sections').objectAt(0).toJSON()).to.eql({
+          "id": "Section-1",
+          "name": "Section-1",
+          "display_name": "Section One",
+          "row_index": "0",
+          "row_span": "1",
+          "column_index": "0",
+          "column_span": "1",
+          "section_columns": "2",
+          "section_rows": "3",
+          "tab_id": "HDFS_settings"
+        });
       });
 
-      //checking subsection
-      
expect(App.Tab.find('HDFS_settings').get('sections').objectAt(0).get('subSections').objectAt(0).toJSON()).to.eql({
-        "id": "subsection1",
-        "name": "subsection1",
-        "display_name": "Storage",
-        "border": "false",
-        "row_index": "0",
-        "row_span": "1",
-        "column_index": "0",
-        "depends_on": [],
-        "config_properties": [],
-        "left_vertical_splitter": true,
-        "column_span": "1",
-        "section_id": "Section-1"
+      it('HDFS_settings section subsection is mapped correctly', function () {
+        //checking subsection
+        
expect(App.Tab.find('HDFS_settings').get('sections').objectAt(0).get('subSections').objectAt(0).toJSON()).to.eql({
+          "id": "subsection1",
+          "name": "subsection1",
+          "display_name": "Storage",
+          "border": "false",
+          "row_index": "0",
+          "row_span": "1",
+          "column_index": "0",
+          "depends_on": [],
+          "config_properties": [],
+          "left_vertical_splitter": true,
+          "column_span": "1",
+          "section_id": "Section-1"
+        });
       });
     });
   });

http://git-wip-us.apache.org/repos/asf/ambari/blob/f8213edb/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 5091c0f..270147a 100644
--- a/ambari-web/test/mappers/service_mapper_test.js
+++ b/ambari-web/test/mappers/service_mapper_test.js
@@ -255,16 +255,19 @@ describe('App.serviceMetricsMapper', function () {
       }
     ];
 
+    beforeEach(function () {
+      this.stub = sinon.stub(App, 'get');
+    });
+
+    afterEach(function () {
+      App.get.restore();
+    });
+
     tests.forEach(function(test) {
       it(test.message, function() {
-        sinon.stub(App, 'get', function(key) {
-          if (key == 'currentStackVersionNumber') {
-            return test.stackVersionNumber;
-          }
-        });
+        
this.stub.withArgs('currentStackVersionNumber').returns(test.stackVersionNumber);
         var result = App.serviceMetricsMapper.stormMapper(test);
         expect(result).to.include(test.expectedValues);
-        App.get.restore();
       });
     });
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/f8213edb/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 d67098c..7b124af 100644
--- a/ambari-web/test/mappers/stack_mapper_test.js
+++ b/ambari-web/test/mappers/stack_mapper_test.js
@@ -261,29 +261,41 @@ describe('App.stackMapper', function () {
       App.resetDsStoreTypeMap(App.OperatingSystem);
       App.resetDsStoreTypeMap(App.Stack);
       sinon.stub(App.store, 'commit', Em.K);
+      App.stackMapper.map(test_data);
     });
     afterEach(function(){
       App.store.commit.restore();
     });
 
-               
     it ('should map active Stack data', function() {
-      App.stackMapper.map(test_data);
       expect(App.Stack.find().get('length')).to.equal(2);
+    });
+
+    it ('all stacks are active', function() {
       expect(App.Stack.find().everyProperty('active')).to.equal(true);
+    });
+
+    it ('no one stack is selected', function() {
       expect(App.Stack.find().everyProperty('isSelected')).to.equal(false);
+    });
+
+    it ('stack ids are valid', function() {
       expect(App.Stack.find().mapProperty('id')).to.eql(['HDP-2.1','HDP-1.3']);
     });
 
-    it ('should map Operating System data', function() {
-      App.stackMapper.map(test_data);
+    it ('4 OSes are mapped', function() {
       expect(App.OperatingSystem.find().get('length')).to.equal(4);
+    });
+
+    it ('OSes have valid ids', function() {
       
expect(App.OperatingSystem.find().mapProperty('id')).to.eql(['HDP-2.1-redhat5', 
'HDP-2.1-redhat6', 'HDP-1.3-redhat5', 'HDP-1.3-redhat6']);
     });
     
-    it ('should map Repository data', function() {
-      App.stackMapper.map(test_data);
+    it ('8 repositories are mapped', function() {
       expect(App.Repository.find().get('length')).to.equal(8);
+    });
+
+    it ('Repositories ids are valid', function() {
       
expect(App.Repository.find().mapProperty('id')).to.eql(["HDP-2.1-redhat5-HDP-2.1",
 "HDP-2.1-redhat5-HDP-UTILS-1.1.0.17", "HDP-2.1-redhat6-HDP-2.1", 
"HDP-2.1-redhat6-HDP-UTILS-1.1.0.17", "HDP-1.3-redhat5-HDP-1.3", 
"HDP-1.3-redhat5-HDP-UTILS-1.1.0.16", "HDP-1.3-redhat6-HDP-1.3", 
"HDP-1.3-redhat6-HDP-UTILS-1.1.0.16"]);
     });
   });

http://git-wip-us.apache.org/repos/asf/ambari/blob/f8213edb/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 7d4f2de..d7b7e9b 100644
--- a/ambari-web/test/utils/blueprint_test.js
+++ b/ambari-web/test/utils/blueprint_test.js
@@ -441,12 +441,10 @@ describe('utils/blueprint', function() {
       expect(blueprintUtils._generateHostMap({}, [],'c1')).to.eql({});
     });
 
-    it('skip throws error when data is wrong', function() {
-      it('should assert error if no data returned from server', function () {
-        expect(function () {
-          blueprintUtils._generateHostMap();
-        }).to.throw(Error);
-      });
+    it('skip throws error when data is wrong (should assert error if no data 
returned from server)', function() {
+      expect(function () {
+        blueprintUtils._generateHostMap();
+      }).to.throw(Error);
     });
   });
 });

http://git-wip-us.apache.org/repos/asf/ambari/blob/f8213edb/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 173ea5f..910cc9f 100644
--- a/ambari-web/test/utils/helper_test.js
+++ b/ambari-web/test/utils/helper_test.js
@@ -239,10 +239,7 @@ describe('utils/helper', function() {
         expect(App.isEmptyObject({ a: 1 })).to.eql(false);
       });
     });
-    describe('#parseJSON()', function(){
-      var testable = '{"hello": "world"}';
-      expect(App.parseJSON(testable).hello).to.eql('world');
-    });
+
     describe('#tooltip()', function() {
       beforeEach(appendDiv);
       afterEach(removeDiv);

http://git-wip-us.apache.org/repos/asf/ambari/blob/f8213edb/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 3c91949..5bb005d 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
@@ -32,65 +32,6 @@ describe('App.MainAlertsManageAlertGroupView', function () {
     view = getView();
   });
 
-  it('#buttonObserver', function () {
-
-    Em.A([
-      {
-        p: {
-          isRemoveButtonDisabled: false,
-          isRenameButtonDisabled: false,
-          isDuplicateButtonDisabled: true
-        },
-        selectedAlertGroup: {default: true},
-        m: 'selected alert group is default',
-        e: {
-          isRemoveButtonDisabled: true,
-          isRenameButtonDisabled: true,
-          isDuplicateButtonDisabled: false
-        }
-      },
-      {
-        p: {
-          isRemoveButtonDisabled: true,
-          isRenameButtonDisabled: true,
-          isDuplicateButtonDisabled: true
-        },
-        selectedAlertGroup: {default: false},
-        m: 'selected alert group is not default',
-        e: {
-          isRemoveButtonDisabled: false,
-          isRenameButtonDisabled: false,
-          isDuplicateButtonDisabled: false
-        }
-      },
-      {
-        p: {
-          isRemoveButtonDisabled: true,
-          isRenameButtonDisabled: true,
-          isDuplicateButtonDisabled: true
-        },
-        selectedAlertGroup: null,
-        m: 'not one alert group is selected',
-        e: {
-          isRemoveButtonDisabled: false,
-          isRenameButtonDisabled: false,
-          isDuplicateButtonDisabled: false
-        }
-      }
-    ]).forEach(function (test) {
-        it(test.m, function () {
-          Em.keys(test.p).forEach(function (k) {
-            view.set(k, test.p[k]);
-          });
-          view.set('controller.selectedAlertGroup', test.selectedAlertGroup);
-          Em.keys(test.e).forEach(function (k) {
-            expect(view.get(k)).to.equal(test.e[k]);
-          });
-        });
-      });
-
-  });
-
   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/f8213edb/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 170eb41..df3aa24 100644
--- a/ambari-web/test/views/main/service/info/summary_test.js
+++ b/ambari-web/test/views/main/service/info/summary_test.js
@@ -185,14 +185,15 @@ describe('App.MainServiceInfoSummaryView', function() {
         serviceName: 'HDFS'
       }));
       expect(view.get('hasAlertDefinitions')).to.be.true;
+    });
+
+    it('should return false if there is no alert definition for this service', 
function () {
+      view.set('controller.content', Em.Object.create({
+        serviceName: 'ZOOKEEPER'
+      }));
+      expect(view.get('hasAlertDefinitions')).to.be.false;
+    });
 
-      it('should return false if there is no alert definition for this 
service', function () {
-        view.set('controller.content', Em.Object.create({
-          serviceName: 'ZOOKEEPER'
-        }));
-        expect(view.get('hasAlertDefinitions')).to.be.false;
-      });
-    })
   });
 
   describe('#didInsertElement', function () {

Reply via email to