blob: 06ebc1be81a3e9d27011eadf92cabfe14bad09b3 [file] [log] [blame]
Matteo Scandolof0c32262016-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 Scandolo6a2b1002016-05-17 17:37:09 -070014 $httpBackend.expectGET('/api/tenant/cord/subscriber/?no_hyperlinks=1').respond([
Matteo Scandolof0c32262016-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 Scandolo6a2b1002016-05-17 17:37:09 -070023 element = angular.element('<truckroll></truckroll>');
Matteo Scandolof0c32262016-03-11 13:47:27 -080024 $compile(element)(scope);
25 scope.$digest();
26 isolatedScope = element.isolateScope().vm;
27 }));
28
29 it('should load 1 users', () => {
30 httpBackend.flush();
Matteo Scandolo6a2b1002016-05-17 17:37:09 -070031 expect(isolatedScope.subscribers.length).toBe(1);
Matteo Scandolof0c32262016-03-11 13:47:27 -080032 });
33
34});