blob: 52ebe8496572c0cd1e34cb96fb3028392439af9d [file] [log] [blame]
Matteo Scandolod7552052016-03-11 13:47:27 -08001'use strict';
2
3describe('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 Scandolo753520b2016-05-17 17:37:09 -070014 $httpBackend.expectGET('/api/tenant/cord/subscriber/?no_hyperlinks=1').respond([
Matteo Scandolod7552052016-03-11 13:47:27 -080015 {
16 email: 'teo@onlab.us',
17 firstname: 'Matteo',
18 lastname: 'Scandolo'
19 }
20 ]);
21
22 scope = $rootScope.$new();
Matteo Scandolo753520b2016-05-17 17:37:09 -070023 element = angular.element('<truckroll></truckroll>');
Matteo Scandolod7552052016-03-11 13:47:27 -080024 $compile(element)(scope);
25 scope.$digest();
26 isolatedScope = element.isolateScope().vm;
27 }));
28
Matteo Scandolo4ac9a0b2016-05-23 15:31:25 -070029 it('should load 1 subscriber', () => {
Matteo Scandolod7552052016-03-11 13:47:27 -080030 httpBackend.flush();
Matteo Scandolo753520b2016-05-17 17:37:09 -070031 expect(isolatedScope.subscribers.length).toBe(1);
Matteo Scandolod7552052016-03-11 13:47:27 -080032 });
33
34});