blob: 3bd610b14f556907103cbd0116bd2595754a3a77 [file] [log] [blame]
arpiagariud4f6db12016-06-06 15:25:28 -07001'use strict';
2
3describe('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 Scandolo88b220e2016-06-17 11:57:05 -070013 httpBackend.whenGET('/api/core/sites/?no_hyperlinks=1').respond(200, []);
arpiagariud4f6db12016-06-06 15:25:28 -070014 // 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 Scandolo88b220e2016-06-17 11:57:05 -070021 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 });
arpiagariud4f6db12016-06-06 15:25:28 -070056 });
arpiagariud4f6db12016-06-06 15:25:28 -070057});