[BP-841] Mock http response in failed unit test
Signed-off-by: Christopher Keim <keim@develop-group.de>
diff --git a/src/app/standby-schedule/dialogs/calculate-dialog/calculate-dialog.component.spec.ts b/src/app/standby-schedule/dialogs/calculate-dialog/calculate-dialog.component.spec.ts
index de44143..29b0024 100644
--- a/src/app/standby-schedule/dialogs/calculate-dialog/calculate-dialog.component.spec.ts
+++ b/src/app/standby-schedule/dialogs/calculate-dialog/calculate-dialog.component.spec.ts
@@ -1,12 +1,17 @@
/********************************************************************************
- * Copyright © 2018 Mettenmeier GmbH.
+ * Copyright © 2018 Mettenmeier GmbH and others.
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0.
*
* SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Mettenmeier GmbH - initial implementation
+ * Basys GmbH - automatic report generation implementation
********************************************************************************/
+
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { NgbModule, NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
@@ -14,10 +19,14 @@
import { CalculateDialogComponent } from './calculate-dialog.component';
import { SharedModule } from '@shared/shared.module';
import { ModalTransferObject } from '@shared/model/ModalTransferObject';
+import {MasterdataService} from '@masterdata/services/masterdata.service';
+import {UserObject} from '@shared/model/UserObject';
+import {of} from 'rxjs';
describe('CalculateDialogComponent', () => {
let component: CalculateDialogComponent;
let fixture: ComponentFixture<CalculateDialogComponent>;
+ const user: UserObject[] = [];
beforeEach(async(() => {
TestBed.configureTestingModule({
@@ -29,14 +38,16 @@
providers: [
NgbActiveModal
]
- })
- .compileComponents();
+ }).compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(CalculateDialogComponent);
component = fixture.componentInstance;
+ const masterService: MasterdataService = TestBed.get(MasterdataService);
+ spyOn(masterService, 'getStandbygroupUniqueUser').and.returnValue(of(user));
component.form.patchValue({ standbyGroupId: 1 });
+
fixture.detectChanges();
});