blob: d71f63e115c0793ad3f5e6e42a563bfede16f0bf [file] [log] [blame]
Matteo Scandolobba1d782016-07-12 15:56:23 -07001'use strict';
2
3// TODO angular-drag-drop is inject in the wrong place, test failing
4
5describe('The User List', () => {
6
7 var scope, element, isolatedScope, httpBackend;
8
9 beforeEach(module('xos.dashboardManager'));
10 beforeEach(module('templates'));
11
12 beforeEach(inject(function($httpBackend, $compile, $rootScope){
13
14 httpBackend = $httpBackend;
15 // Setting up mock request
16 $httpBackend.expectGET('/api/core/users/?no_hyperlinks=1').respond([
17 {
18 email: 'matteo.scandolo@gmail.com',
19 firstname: 'Matteo',
20 lastname: 'Scandolo'
21 }
22 ]);
23
24 scope = $rootScope.$new();
25 element = angular.element('<users-list></users-list>');
26 $compile(element)(scope);
27 scope.$digest();
28 isolatedScope = element.isolateScope().vm;
29 }));
30
31 xit('should load 1 users', () => {
32 httpBackend.flush();
33 expect(isolatedScope.users.length).toBe(1);
34 expect(isolatedScope.users[0].email).toEqual('matteo.scandolo@gmail.com');
35 expect(isolatedScope.users[0].firstname).toEqual('Matteo');
36 expect(isolatedScope.users[0].lastname).toEqual('Scandolo');
37 });
38
39});