1 | import { VaSalespersonDetailsComponent } from './salesperson-details.component';
|
2 | describe('VaSalespersonDetailsComponent', function () {
|
3 | var component;
|
4 | var salesperson;
|
5 | beforeEach(function () {
|
6 | component = new VaSalespersonDetailsComponent();
|
7 | salesperson = {
|
8 | firstName: null,
|
9 | lastName: null,
|
10 | salesPersonId: null,
|
11 | formattedName: null,
|
12 | city: null,
|
13 | state: null,
|
14 | email: null,
|
15 | mainPhoneNumber: null,
|
16 | jobTitle: null,
|
17 | photoUrlSecure: null
|
18 | };
|
19 | });
|
20 | it('should get the icon url if the salesperson has one', function () {
|
21 | component.salesperson = salesperson;
|
22 | component.salesperson.photoUrlSecure = 'www.photoUrlSecure.com';
|
23 | expect(component.iconUrl).toEqual('www.photoUrlSecure.com');
|
24 | });
|
25 | it('should return default icon url if the salesperson has no photo', function () {
|
26 | component.salesperson = salesperson;
|
27 | expect(component.iconUrl).toEqual('https://vbc-frontend.storage-download.googleapis.com/salesperson-details/default_sales_person.jpg');
|
28 | });
|
29 | it('should return empty string if no first name', function () {
|
30 | component.salesperson = salesperson;
|
31 | expect(component.name).toEqual('');
|
32 | });
|
33 | it('should get the title if the salesperson has one', function () {
|
34 | component.salesperson = salesperson;
|
35 | component.salesperson.jobTitle = 'gym leader';
|
36 | expect(component.title).toEqual('gym leader');
|
37 | });
|
38 | it('should return empty string if no job title', function () {
|
39 | component.salesperson = salesperson;
|
40 | expect(component.title).toEqual('');
|
41 | });
|
42 | it('should get the email if the salesperson has one', function () {
|
43 | component.salesperson = salesperson;
|
44 | component.salesperson.email = 'gary@oak.com';
|
45 | expect(component.email).toEqual('gary@oak.com');
|
46 | });
|
47 | it('should return empty string if no email', function () {
|
48 | component.salesperson = salesperson;
|
49 | expect(component.email).toEqual('');
|
50 | });
|
51 | it('should get the title if the salesperson has one', function () {
|
52 | component.salesperson = salesperson;
|
53 | component.salesperson.city = 'pallet town';
|
54 | component.salesperson.state = 'kanto';
|
55 | expect(component.cityAndState).toEqual('pallet town, kanto');
|
56 | });
|
57 | it('should return empty string if no city', function () {
|
58 | component.salesperson = salesperson;
|
59 | component.salesperson.state = 'kanto';
|
60 | expect(component.cityAndState).toEqual('');
|
61 | });
|
62 | it('should return empty string if no state', function () {
|
63 | component.salesperson = salesperson;
|
64 | component.salesperson.city = 'pallet town';
|
65 | expect(component.cityAndState).toEqual('');
|
66 | });
|
67 | });
|