arpiagariu | 827f392 | 2016-06-06 15:25:28 -0700 | [diff] [blame] | 1 | 'use strict'; |
| 2 | |
| 3 | describe('Tenant View', () => { |
| 4 | |
| 5 | var scope, element, isolatedScope, httpBackend; |
| 6 | |
| 7 | beforeEach(module('xos.tenant')); |
| 8 | beforeEach(module('templates')); |
| 9 | |
| 10 | beforeEach(inject(function($httpBackend, $compile, $rootScope){ |
| 11 | |
| 12 | httpBackend = $httpBackend; |
| 13 | // Setting up mock request |
| 14 | scope = $rootScope.$new(); |
| 15 | element = angular.element('<users-list></users-list>'); |
| 16 | $compile(element)(scope); |
| 17 | scope.$digest(); |
| 18 | isolatedScope = element.isolateScope().vm; |
| 19 | })); |
| 20 | describe('site list table',() =>{ |
| 21 | it('site list ', () => { |
| 22 | var sites = [ |
| 23 | { |
| 24 | 'name':'Mysite', |
| 25 | 'id':'1' |
| 26 | |
| 27 | }]; |
| 28 | var slices = [{ |
| 29 | 'site':'1', |
| 30 | 'instance_total':1, |
| 31 | 'instance_total_ready':1 |
| 32 | }, |
| 33 | { |
| 34 | 'site':'1', |
| 35 | 'instance_total':2, |
| 36 | 'instance_total_ready':3 |
| 37 | }, |
| 38 | { |
| 39 | 'site':'2', |
| 40 | 'instance_total':'1', |
| 41 | 'instance_total_ready':'2' |
| 42 | }]; |
| 43 | var result = isolatedScope.returnData(sites,slices); |
| 44 | expect(result).toEqual([{ |
| 45 | 'name':'Mysite', |
| 46 | 'id':'1', |
| 47 | 'instance_total':3, |
| 48 | 'instance_total_ready':4 |
| 49 | } |
| 50 | ]) |
| 51 | //httpBackend.flush(); |
| 52 | }); |
| 53 | }); |
| 54 | }); |