[SI-756] unit tests added

Signed-off-by: Peter Buschmann <peter.buschmann@pta.de>
diff --git a/projects/grid-failure-information-app/src/app/pages/distribution-group/distribution-group.sandbox.spec.ts b/projects/grid-failure-information-app/src/app/pages/distribution-group/distribution-group.sandbox.spec.ts
index bbf98ca..0166972 100644
--- a/projects/grid-failure-information-app/src/app/pages/distribution-group/distribution-group.sandbox.spec.ts
+++ b/projects/grid-failure-information-app/src/app/pages/distribution-group/distribution-group.sandbox.spec.ts
@@ -87,7 +87,7 @@
     expect(appState.dispatch).toHaveBeenCalled();
   });
 
-  it('should dispatch an action via showMembersToSelectedGroup()', () => {
+  it('should not dispatch an action via showMembersToSelectedGroup() when no selectedGroup is provided', () => {
     service.showMembersToSelectedGroup(undefined);
     expect(appState.dispatch).not.toHaveBeenCalled();
   });
@@ -139,4 +139,16 @@
     service.deleteDistributionGroupMember('x', 'y');
     expect(appState.dispatch).toHaveBeenCalledWith(distributionGroupActions.deleteDistributionGroupMember({ groupId: 'x', memberId: 'y' }));
   });
+
+  it('should exportContacts via exportContacts action', () => {
+    service['_selectedDistributionGroup'] = new DistributionGroup({ id: 'x' });
+    service.exportContacts();
+    expect(appState.dispatch).toHaveBeenCalledWith(distributionGroupActions.exportContacts({ groupId: 'x' }));
+  });
+
+  it('should not exportContacts via exportContacts action when no selectedDistributionGroup is provided', () => {
+    service['_selectedDistributionGroup'] = undefined;
+    service.exportContacts();
+    expect(appState.dispatch).not.toHaveBeenCalled();
+  });
 });
diff --git a/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure-details/grid-failure-details.component.spec.ts b/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure-details/grid-failure-details.component.spec.ts
index e6f1472..8a36e60 100644
--- a/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure-details/grid-failure-details.component.spec.ts
+++ b/projects/grid-failure-information-app/src/app/pages/grid-failure/grid-failure-details/grid-failure-details.component.spec.ts
@@ -1,4 +1,3 @@
-import { FailureBranch } from './../../../shared/models/failure-branch.model';
 /********************************************************************************
  * Copyright (c) 2020 Contributors to the Eclipse Foundation
  *
@@ -18,7 +17,6 @@
 import { Globals } from '@grid-failure-information-app/shared/constants/globals';
 import { INITIAL_STATE } from '@grid-failure-information-app/shared/store/reducers/grid-failures/grid-failure-details-form.reducer';
 import * as models from '@grid-failure-information-app/shared/models';
-import { fakeAsync } from '@angular/core/testing';
 
 describe('GridFailureDetailsComponent', () => {
   let component: GridFailureDetailsComponent;
@@ -313,7 +311,7 @@
 
   it('should set Branch State correctly', () => {
     const spy: any = spyOn(gridFailureSandbox, 'setBranchState');
-    component.gridFailureDetailsSandbox.branches = [new FailureBranch()];
+    component.gridFailureDetailsSandbox.branches = [new models.FailureBranch()];
     component.setBranchValue('id1');
     expect(spy).toHaveBeenCalled();
   });
@@ -322,4 +320,25 @@
     component.setNewGridOptions('1');
     expect(component.gridOptions.context.icons).toBeDefined();
   });
+
+  it('should return true for telecommunication', () => {
+    let branch = Globals.BUSINESS_RULE_FIELDS.branch.telecommunication;
+    expect(component.isLocationButtonForStationVisible(branch)).toBeTruthy();
+  });
+
+  it('should return true for power / ms', () => {
+    let branch = Globals.BUSINESS_RULE_FIELDS.branch.power;
+    let voltageLevel = Globals.FAILURE_LOCATION_MS;
+    expect(component.isLocationButtonForStationVisible(branch, voltageLevel)).toBeTruthy();
+  });
+
+  it('should return false for other defined branches', () => {
+    let branch = Globals.BUSINESS_RULE_FIELDS.branch.water;
+    expect(component.isLocationButtonForStationVisible(branch)).toBeFalsy();
+  });
+
+  it('should return false for unknown branches', () => {
+    let branch = 'X';
+    expect(component.isLocationButtonForStationVisible(branch)).toBeUndefined();
+  });
 });
diff --git a/projects/grid-failure-information-app/src/app/shared/store/effects/distribution-groups.effect.spec.ts b/projects/grid-failure-information-app/src/app/shared/store/effects/distribution-groups.effect.spec.ts
index 2de036d..5ff9c77 100644
--- a/projects/grid-failure-information-app/src/app/shared/store/effects/distribution-groups.effect.spec.ts
+++ b/projects/grid-failure-information-app/src/app/shared/store/effects/distribution-groups.effect.spec.ts
@@ -37,6 +37,7 @@
       getContacts() {},
       postDistributionGroupMember() {},
       getDistributionGroupTextPlaceholders() {},
+      exportContacts() {},
     } as any;
     store = {
       dispatch() {},
@@ -227,4 +228,23 @@
     done();
     actions$.next(distributionGroupActions.loadDistributionGroupTextPlaceholders());
   });
+
+  it('should equal exportContactsSuccess after exportContacts was called', done => {
+    apiResponse = new Object();
+    spyOn(apiClient, 'exportContacts').and.returnValue(of(apiResponse));
+    effects.exportContacts$.pipe(take(1)).subscribe(result => {
+      expect(result).toEqual(distributionGroupActions.exportContactsSuccess({ payload: apiResponse }));
+    });
+    done();
+    actions$.next(distributionGroupActions.exportContacts({ groupId: 'x' }));
+  });
+
+  it('should equal exportContactsFail after exportContacts throws an error', done => {
+    spyOn(apiClient, 'exportContacts').and.returnValue(throwError('x'));
+    effects.exportContacts$.pipe(take(1)).subscribe(result => {
+      expect(result).toEqual(distributionGroupActions.exportContactsFail({ payload: 'x' }));
+    });
+    done();
+    actions$.next(distributionGroupActions.exportContacts({ groupId: 'x' }));
+  });
 });