Added tests for ceilometer dashboar
diff --git a/xos/core/static/xos.css b/xos/core/static/xos.css
index 40cfcc3..685361e 100644
--- a/xos/core/static/xos.css
+++ b/xos/core/static/xos.css
@@ -62,6 +62,7 @@
   -moz-transition: all 0.5s ease;
   -o-transition: all 0.5s ease;
   transition: all 0.5s ease;
+  background: white;
 }
 
 #wrapper.toggled #sidebar-wrapper {
diff --git a/xos/core/xoslib/ngXosViews/ceilometerDashboard/.eslintrc b/xos/core/xoslib/ngXosViews/ceilometerDashboard/.eslintrc
index f495e79..ff5fdae 100644
--- a/xos/core/xoslib/ngXosViews/ceilometerDashboard/.eslintrc
+++ b/xos/core/xoslib/ngXosViews/ceilometerDashboard/.eslintrc
@@ -16,7 +16,7 @@
     ],
     "rules": {
         "quotes": [2, "single"],
-        "camelcase": [1, {"properties": "always"}],
+        "camelcase": [0, {"properties": "always"}],
         "no-underscore-dangle": 1,
         "eqeqeq": [2, "smart"],
         "no-alert": 1,
diff --git a/xos/core/xoslib/ngXosViews/ceilometerDashboard/karma.conf.js b/xos/core/xoslib/ngXosViews/ceilometerDashboard/karma.conf.js
index dbd344a..12d0697 100644
--- a/xos/core/xoslib/ngXosViews/ceilometerDashboard/karma.conf.js
+++ b/xos/core/xoslib/ngXosViews/ceilometerDashboard/karma.conf.js
@@ -10,9 +10,8 @@
 var bowerComponents = wiredep( {devDependencies: true} )[ 'js' ].map(function( file ){
   return path.relative(process.cwd(), file);
 });
-
-module.exports = function(config) {
 /*eslint-enable*/
+module.exports = function(config) {
   config.set({
 
     // base path that will be used to resolve all patterns (eg. files, exclude)
@@ -45,10 +44,17 @@
     // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
     preprocessors: {
       'src/js/**/*.js': ['babel'],
-      'spec/**/*.test.js': ['babel'],
+      'spec/**/*.js': ['babel'],
       'src/**/*.html': ['ng-html2js']
     },
 
+    babelPreprocessor: {
+      options: {
+        presets: ['es2015'],
+        sourceMap: 'inline'
+      }
+    },
+
     ngHtml2JsPreprocessor: {
       stripPrefix: 'src/', //strip the src path from template url (http://stackoverflow.com/questions/22869668/karma-unexpected-request-when-testing-angular-directive-even-with-ng-html2js)
       moduleName: 'templates' // define the template module name
diff --git a/xos/core/xoslib/ngXosViews/ceilometerDashboard/package.json b/xos/core/xoslib/ngXosViews/ceilometerDashboard/package.json
index ba3a8fd..2363427 100644
--- a/xos/core/xoslib/ngXosViews/ceilometerDashboard/package.json
+++ b/xos/core/xoslib/ngXosViews/ceilometerDashboard/package.json
@@ -19,6 +19,8 @@
   "license": "MIT",
   "dependencies": {},
   "devDependencies": {
+    "babel": "^6.3.13",
+    "babel-preset-es2015": "^6.3.13",
     "browser-sync": "^2.9.11",
     "del": "^2.0.2",
     "eslint": "^1.8.0",
@@ -37,8 +39,16 @@
     "gulp-replace": "^0.5.4",
     "gulp-uglify": "^1.4.2",
     "http-proxy": "^1.12.0",
+    "jasmine-core": "^2.4.1",
     "karma": "^0.13.15",
+    "karma-babel-preprocessor": "^6.0.1",
+    "karma-jasmine": "^0.3.6",
+    "karma-mocha-reporter": "^1.1.3",
+    "karma-ng-html2js-preprocessor": "^0.2.0",
+    "karma-phantomjs-launcher": "^0.2.1",
     "lodash": "^3.10.1",
+    "mocha": "^2.3.4",
+    "phantomjs": "^1.9.19",
     "proxy-middleware": "^0.15.0",
     "run-sequence": "^1.1.4",
     "wiredep": "^3.0.0-beta",
diff --git a/xos/core/xoslib/ngXosViews/ceilometerDashboard/spec/.eslintrc b/xos/core/xoslib/ngXosViews/ceilometerDashboard/spec/.eslintrc
new file mode 100644
index 0000000..ad4bc2d
--- /dev/null
+++ b/xos/core/xoslib/ngXosViews/ceilometerDashboard/spec/.eslintrc
@@ -0,0 +1,9 @@
+{
+    "globals" :{
+        "describe": true,
+        "beforeEach": true,
+        "it": true,
+        "inject": true,
+        "expect": true
+    } 
+}
diff --git a/xos/core/xoslib/ngXosViews/ceilometerDashboard/spec/backend.mock.js b/xos/core/xoslib/ngXosViews/ceilometerDashboard/spec/backend.mock.js
new file mode 100644
index 0000000..71a0040
--- /dev/null
+++ b/xos/core/xoslib/ngXosViews/ceilometerDashboard/spec/backend.mock.js
@@ -0,0 +1,98 @@
+'use strict';
+(function () {
+
+  const meters = [
+    // service_1
+    //  - slice_1
+    //    - resource_1
+    // service_2
+    //  - slice_2
+    //    - resource_2
+    //    - resource_3
+    //  - slice_3
+    //    - resource_4
+    {
+      service: 'service_1',
+      slice: 'slice_1',
+      resource_name: 'resource_1',
+      resource_id: 'resource_id_1',
+      name: 'instance_1',
+      unit: 'instance'
+    },
+    {
+      service: 'service_2',
+      slice: 'slice_2',
+      resource_name: 'resource_2',
+      resource_id: 'resource_id_2',
+      name: 'instance_2',
+      unit: 'instance'
+    },
+    {
+      service: 'service_2',
+      slice: 'slice_2',
+      resource_name: 'resource_3',
+      resource_id: 'resource_id_3',
+      name: 'instance_2',
+      unit: 'instance'
+    },
+    {
+      service: 'service_2',
+      slice: 'slice_3',
+      resource_name: 'resource_4',
+      resource_id: 'resource_id_4',
+      name: 'instance_3',
+      unit: 'instance'
+    }
+  ];
+
+  const samples = [
+    {
+      meter: 'cpu',
+      resource_name: 'fakeName',
+      resource_id: 'fakeTenant',
+      timestamp: '2015-12-15T00:34:08',
+      volume: 110
+    },
+    {
+      meter: 'cpu',
+      resource_name: 'fakeName',
+      resource_id: 'fakeTenant',
+      timestamp: '2015-12-15T00:44:08',
+      volume: 120
+    },
+    {
+      meter: 'cpu',
+      resource_name: 'anotherName',
+      resource_id: 'anotherTenant',
+      timestamp: '2015-12-15T00:24:08',
+      volume: 210
+    },
+    {
+      meter: 'cpu',
+      resource_name: 'anotherName',
+      resource_id: 'anotherTenant',
+      timestamp: '2015-12-15T00:34:08',
+      volume: 220
+    },
+    {
+      meter: 'cpu',
+      resource_name: 'anotherName',
+      resource_id: 'anotherTenant',
+      timestamp: '2015-12-15T00:44:08',
+      volume: 230
+    },
+    {
+      meter: 'cpu',
+      resource_name: 'thirdName',
+      resource_id: 'thirdTenant',
+      timestamp: '2015-12-15T00:44:08',
+      volume: 310
+    }
+  ];
+
+  angular.module('xos.ceilometerDashboard')
+  .run(($httpBackend) => {
+    $httpBackend.whenGET(/metersamples/).respond(samples);
+    $httpBackend.whenGET(/meters/).respond(meters);
+  });
+})();
diff --git a/xos/core/xoslib/ngXosViews/ceilometerDashboard/spec/ceilometer.test.js b/xos/core/xoslib/ngXosViews/ceilometerDashboard/spec/ceilometer.test.js
new file mode 100644
index 0000000..8274853
--- /dev/null
+++ b/xos/core/xoslib/ngXosViews/ceilometerDashboard/spec/ceilometer.test.js
@@ -0,0 +1,97 @@
+'use strict';
+
+describe('In Ceilometer View', () => {
+  
+  var scope, element, vm, httpBackend;
+
+  beforeEach(module('xos.ceilometerDashboard'));
+  beforeEach(module('templates'));
+
+  beforeEach(inject(($httpBackend, $rootScope) => {
+    httpBackend = $httpBackend;
+    scope = $rootScope.$new();
+  }))
+
+  describe('The dashboard', () => {
+    beforeEach(inject(function($httpBackend, $compile){
+      element = angular.element('<ceilometer-dashboard></ceilometer-dashboard>');
+      $compile(element)(scope);
+      scope.$digest();
+      vm = element.isolateScope().vm;
+      httpBackend.flush();
+    }));
+
+    describe('when loading meters', () => {
+      it('should group meters by services', () => {
+        expect(Object.keys(vm.projects).length).toBe(2);
+      });
+
+      it('should group services by slices', () => {
+        expect(Object.keys(vm.projects.service_2).length).toBe(2);
+      });
+
+      it('should group slices by resources', () => {
+        expect(Object.keys(vm.projects.service_2.slice_2).length).toBe(2);
+      });
+    });
+  });
+
+  describe('the sample view', () => {
+    beforeEach(inject(function($httpBackend, $compile, $stateParams){
+
+      $stateParams.name = 'fakeName';
+      $stateParams.tenant = 'fakeTenant';
+
+      element = angular.element('<ceilometer-samples></ceilometer-samples>');
+      $compile(element)(scope);
+      scope.$digest();
+      vm = element.isolateScope().vm;
+      httpBackend.flush();
+    }));
+
+    it('should group samples by resource_id', () => {
+      expect(Object.keys(vm.samplesList.fakeTenant).length).toBe(2)
+      expect(Object.keys(vm.samplesList.anotherTenant).length).toBe(3)
+      expect(Object.keys(vm.samplesList.thirdTenant).length).toBe(1)
+    });
+
+    it('should add the comparable samples to the dropdown list', () => {
+      expect(vm.sampleLabels[0].id).toEqual('anotherTenant')
+      expect(vm.sampleLabels[1].id).toEqual('thirdTenant')
+    });
+
+    it('should add the selected meter to the chart', () => {
+      expect(vm.chart.labels.length).toBe(2);
+      expect(vm.chart.series[0]).toBe('fakeTenant');
+      expect(vm.chart.data[0].length).toBe(2);
+      expect(vm.chart.data[0][0]).toBe(110);
+      expect(vm.chart.data[0][1]).toBe(120);
+      expect(vm.chartMeters[0].resource_id).toBe('fakeTenant')
+      expect(vm.chartMeters[0].resource_name).toBe('fakeName')
+    });
+
+    it('should add a sample to the chart', () => {
+      vm.addMeterToChart('anotherTenant');
+      expect(vm.chart.labels.length).toBe(3);
+      expect(vm.chart.data[1].length).toBe(3);
+      expect(vm.chart.data[1][0]).toBe(210);
+      expect(vm.chart.data[1][1]).toBe(220);
+      expect(vm.chart.data[1][2]).toBe(230);
+      expect(vm.chartMeters[1].resource_id).toBe('anotherTenant')
+      expect(vm.chartMeters[1].resource_name).toBe('anotherName')
+    });
+
+    it('should remove a sample from the chart', () => {
+      // for simplyvity add a tenant (it's tested)
+      vm.addMeterToChart('anotherTenant');
+      vm.removeFromChart(vm.chartMeters[0]);
+      expect(vm.chart.data[0].length).toBe(3);
+      expect(vm.chart.data[0][0]).toBe(210);
+      expect(vm.chart.data[0][1]).toBe(220);
+      expect(vm.chart.data[0][2]).toBe(230);
+      expect(vm.chartMeters[0].resource_id).toBe('anotherTenant')
+      expect(vm.chartMeters[0].resource_name).toBe('anotherName')
+    });
+  });
+
+});
\ No newline at end of file
diff --git a/xos/core/xoslib/ngXosViews/ceilometerDashboard/spec/sample.test.js b/xos/core/xoslib/ngXosViews/ceilometerDashboard/spec/sample.test.js
deleted file mode 100644
index a224095..0000000
--- a/xos/core/xoslib/ngXosViews/ceilometerDashboard/spec/sample.test.js
+++ /dev/null
@@ -1,34 +0,0 @@
-'use strict';
-
-describe('The User List', () => {
-  
-  var scope, element, isolatedScope, httpBackend;
-
-  beforeEach(module('xos.ceilometerDashboard'));
-  beforeEach(module('templates'));
-
-  beforeEach(inject(function($httpBackend, $compile, $rootScope){
-
-    httpBackend = $httpBackend;
-    // Setting up mock request
-    $httpBackend.expectGET(/meters/).respond([
-      {
-        email: 'teo@onlab.us',
-        firstname: 'Matteo',
-        lastname: 'Scandolo'
-      }
-    ]);
-  
-    scope = $rootScope.$new();
-    element = angular.element('<ceilometer-dashboard></ceilometer-dashboard>');
-    $compile(element)(scope);
-    scope.$digest();
-    isolatedScope = element.isolateScope().vm;
-  }));
-
-  it('should load 1 users', () => {
-    httpBackend.flush();
-    expect(isolatedScope.meters.length).toBe(1);
-  });
-
-});
\ No newline at end of file
diff --git a/xos/core/xoslib/ngXosViews/ceilometerDashboard/src/js/main.js b/xos/core/xoslib/ngXosViews/ceilometerDashboard/src/js/main.js
index e85a26e..9506139 100644
--- a/xos/core/xoslib/ngXosViews/ceilometerDashboard/src/js/main.js
+++ b/xos/core/xoslib/ngXosViews/ceilometerDashboard/src/js/main.js
@@ -101,6 +101,7 @@
       this.loadMeters = () => {
         this.loader = true;
 
+        // TODO rename projects in meters
         Ceilometer.getMeters()
         .then(meters => {
           //group project by service
@@ -204,9 +205,12 @@
       if($stateParams.name && $stateParams.tenant){
         this.name = $stateParams.name;
         this.tenant = $stateParams.tenant;
+        // console.log('++++++++++', this.name, this.tenant);
+        // TODO rename tenant in resource_id
       }
-
-      // Mock
+      else{
+        throw new Error('Missing Name and Tenant Params!');
+      }
 
       /**
       * Goes trough the array and format date to be used as labels
@@ -247,7 +251,6 @@
         this.chart['labels'] = this.getLabels(lodash.sortBy(this.samplesList[resource_id], 'timestamp'));
         this.chart['series'].push(resource_id);
         this.chart['data'].push(this.getData(lodash.sortBy(this.samplesList[resource_id], 'timestamp')));
-        console.log(this.samplesList[resource_id]);
         this.chartMeters.push(this.samplesList[resource_id][0]); //use the 0 as are all samples for the same resource and I need the name
         lodash.remove(this.sampleLabels, {id: resource_id});
       }
@@ -255,7 +258,7 @@
       this.removeFromChart = (meter) => {
         this.chart.data.splice(this.chart.series.indexOf(meter.resource_id), 1);
         this.chart.series.splice(this.chart.series.indexOf(meter.resource_id), 1);
-        this.chartMeters.splice(this.chartMeters.indexOf(meter.resource_id), 1);
+        this.chartMeters.splice(lodash.findIndex(this.chartMeters, {resource_id: meter.resource_id}), 1);
         this.sampleLabels.push({
           id: meter.resource_id,
           name: meter.resource_name