Matteo Scandolo | df35ca9 | 2016-02-25 09:19:41 -0800 | [diff] [blame] | 1 | 'use strict'; |
| 2 | |
| 3 | describe('The User List', () => { |
| 4 | |
| 5 | var scope, element, isolatedScope, httpBackend; |
| 6 | |
| 7 | beforeEach(module('xos.mcordTopology')); |
| 8 | 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: 'teo@onlab.us', |
| 17 | firstname: 'Matteo', |
| 18 | lastname: 'Scandolo' |
| 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 | |
Matteo Scandolo | 61c42e4 | 2016-05-25 13:36:56 -0700 | [diff] [blame] | 29 | xit('should load 1 users', () => { |
Matteo Scandolo | df35ca9 | 2016-02-25 09:19:41 -0800 | [diff] [blame] | 30 | httpBackend.flush(); |
| 31 | expect(isolatedScope.users.length).toBe(1); |
| 32 | expect(isolatedScope.users[0].email).toEqual('teo@onlab.us'); |
| 33 | expect(isolatedScope.users[0].firstname).toEqual('Matteo'); |
| 34 | expect(isolatedScope.users[0].lastname).toEqual('Scandolo'); |
| 35 | }); |
| 36 | |
| 37 | }); |