arpiagariu | d4f6db1 | 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; |
Matteo Scandolo | 88b220e | 2016-06-17 11:57:05 -0700 | [diff] [blame] | 13 | httpBackend.whenGET('/api/core/sites/?no_hyperlinks=1').respond(200, []); |
arpiagariu | d4f6db1 | 2016-06-06 15:25:28 -0700 | [diff] [blame] | 14 | // Setting up mock request |
| 15 | scope = $rootScope.$new(); |
| 16 | element = angular.element('<users-list></users-list>'); |
| 17 | $compile(element)(scope); |
| 18 | scope.$digest(); |
| 19 | isolatedScope = element.isolateScope().vm; |
| 20 | })); |
Matteo Scandolo | 88b220e | 2016-06-17 11:57:05 -0700 | [diff] [blame] | 21 | describe('site list table',() =>{ |
| 22 | it('site list ', () => { |
| 23 | var sites = [ |
| 24 | { |
| 25 | 'name':'Mysite', |
| 26 | 'id':'1' |
| 27 | } |
| 28 | ]; |
| 29 | var slices = [ |
| 30 | { |
| 31 | 'site': '1', |
| 32 | 'instance_total' :1, |
| 33 | 'instance_total_ready' :1 |
| 34 | }, |
| 35 | { |
| 36 | 'site': '1', |
| 37 | 'instance_total': 2, |
| 38 | 'instance_total_ready': 3 |
| 39 | }, |
| 40 | { |
| 41 | 'site': '2', |
| 42 | 'instance_total': '1', |
| 43 | 'instance_total_ready': '2' |
| 44 | } |
| 45 | ]; |
| 46 | var result = isolatedScope.returnData(sites,slices); |
| 47 | expect(result).toEqual([ |
| 48 | { |
| 49 | 'name':'Mysite', |
| 50 | 'id':'1', |
| 51 | 'instance_total':3, |
| 52 | 'instance_total_ready':4 |
| 53 | } |
| 54 | ]); |
| 55 | }); |
arpiagariu | d4f6db1 | 2016-06-06 15:25:28 -0700 | [diff] [blame] | 56 | }); |
arpiagariu | d4f6db1 | 2016-06-06 15:25:28 -0700 | [diff] [blame] | 57 | }); |