blob: 822c114c05ce793c1ed4ae54159298fa84c74cd3 [file] [log] [blame]
Jeremy Mowery159f97b2016-02-25 09:32:00 -07001'use strict';
2
3describe('The User List', () => {
4
5 var scope, element, isolatedScope, httpBackend;
6
Jeremy Mowery1b09b332016-04-19 17:01:48 -07007 beforeEach(module('xos.openVPNDashboard'));
Jeremy Mowery159f97b2016-02-25 09:32:00 -07008 beforeEach(module('templates'));
9
10 beforeEach(inject(function($httpBackend, $compile, $rootScope){
11
12 httpBackend = $httpBackend;
13 // Setting up mock request
14 $httpBackend.expectGET('/xos/users/?no_hyperlinks=1').respond([
15 {
16 email: 'jermowery@email.arizona.edu',
17 firstname: 'Jeremy',
18 lastname: 'Mowery'
19 }
20 ]);
21
22 scope = $rootScope.$new();
23 element = angular.element('<users-list></users-list>');
24 $compile(element)(scope);
25 scope.$digest();
26 isolatedScope = element.isolateScope().vm;
27 }));
28
29 it('should load 1 users', () => {
30 httpBackend.flush();
31 expect(isolatedScope.users.length).toBe(1);
32 expect(isolatedScope.users[0].email).toEqual('jermowery@email.arizona.edu');
33 expect(isolatedScope.users[0].firstname).toEqual('Jeremy');
34 expect(isolatedScope.users[0].lastname).toEqual('Mowery');
35 });
36
37});