From 64a9e554a3bfbe55fb2bb4f12320830a7846f412 Mon Sep 17 00:00:00 2001 From: Tiago Melo Date: Fri, 2 Mar 2018 12:14:57 +0000 Subject: [PATCH] mgr/dashboard_v2: add mocked service provider for TcmuIscsiService This removes the warnings shown when running the tests with PhantomJS. Signed-off-by: Tiago Melo --- .../ceph/block/iscsi/iscsi.component.spec.ts | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/src/pybind/mgr/dashboard_v2/frontend/src/app/ceph/block/iscsi/iscsi.component.spec.ts b/src/pybind/mgr/dashboard_v2/frontend/src/app/ceph/block/iscsi/iscsi.component.spec.ts index c0f4c364663..78c19b07247 100644 --- a/src/pybind/mgr/dashboard_v2/frontend/src/app/ceph/block/iscsi/iscsi.component.spec.ts +++ b/src/pybind/mgr/dashboard_v2/frontend/src/app/ceph/block/iscsi/iscsi.component.spec.ts @@ -1,18 +1,29 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { AppModule } from '../../../app.module'; +import { TcmuIscsiService } from '../../../shared/services/tcmu-iscsi.service'; import { IscsiComponent } from './iscsi.component'; describe('IscsiComponent', () => { let component: IscsiComponent; let fixture: ComponentFixture; - beforeEach(async(() => { - TestBed.configureTestingModule({ - imports: [AppModule] + const fakeService = { + tcmuiscsi: () => { + return new Promise(function(resolve, reject) { + return; + }); + }, + }; + + beforeEach( + async(() => { + TestBed.configureTestingModule({ + imports: [AppModule], + providers: [{ provide: TcmuIscsiService, useValue: fakeService }] + }).compileComponents(); }) - .compileComponents(); - })); + ); beforeEach(() => { fixture = TestBed.createComponent(IscsiComponent); -- 2.39.5