Matteo Scandolo | d755205 | 2016-03-11 13:47:27 -0800 | [diff] [blame] | 1 | 'use strict'; |
| 2 | |
| 3 | describe('The User List', () => { |
| 4 | |
| 5 | var scope, element, isolatedScope, httpBackend; |
| 6 | |
| 7 | beforeEach(module('xos.truckroll')); |
| 8 | beforeEach(module('templates')); |
| 9 | |
| 10 | beforeEach(inject(function($httpBackend, $compile, $rootScope){ |
| 11 | |
| 12 | httpBackend = $httpBackend; |
| 13 | // Setting up mock request |
Matteo Scandolo | 753520b | 2016-05-17 17:37:09 -0700 | [diff] [blame] | 14 | $httpBackend.expectGET('/api/tenant/cord/subscriber/?no_hyperlinks=1').respond([ |
Matteo Scandolo | d755205 | 2016-03-11 13:47:27 -0800 | [diff] [blame] | 15 | { |
| 16 | email: 'teo@onlab.us', |
| 17 | firstname: 'Matteo', |
| 18 | lastname: 'Scandolo' |
| 19 | } |
| 20 | ]); |
| 21 | |
| 22 | scope = $rootScope.$new(); |
Matteo Scandolo | 753520b | 2016-05-17 17:37:09 -0700 | [diff] [blame] | 23 | element = angular.element('<truckroll></truckroll>'); |
Matteo Scandolo | d755205 | 2016-03-11 13:47:27 -0800 | [diff] [blame] | 24 | $compile(element)(scope); |
| 25 | scope.$digest(); |
| 26 | isolatedScope = element.isolateScope().vm; |
| 27 | })); |
| 28 | |
Matteo Scandolo | 4ac9a0b | 2016-05-23 15:31:25 -0700 | [diff] [blame] | 29 | it('should load 1 subscriber', () => { |
Matteo Scandolo | d755205 | 2016-03-11 13:47:27 -0800 | [diff] [blame] | 30 | httpBackend.flush(); |
Matteo Scandolo | 753520b | 2016-05-17 17:37:09 -0700 | [diff] [blame] | 31 | expect(isolatedScope.subscribers.length).toBe(1); |
Matteo Scandolo | d755205 | 2016-03-11 13:47:27 -0800 | [diff] [blame] | 32 | }); |
| 33 | |
| 34 | }); |