diff --git a/web-ui/src/app/components/masternode-details/masternode-details.component.spec.ts b/web-ui/src/app/components/masternode-details/masternode-details.component.spec.ts index 1ca4d3a..a015a25 100644 --- a/web-ui/src/app/components/masternode-details/masternode-details.component.spec.ts +++ b/web-ui/src/app/components/masternode-details/masternode-details.component.spec.ts @@ -1,14 +1,46 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { MasternodeDetailsComponent } from './masternode-details.component'; +import { ExplorerDatetimePipe } from '../../pipes/explorer-datetime.pipe'; + +import { MomentModule } from 'ngx-moment'; +import { TranslateModule } from '@ngx-translate/core'; +import { RouterTestingModule } from '@angular/router/testing'; + +import { NavigatorService } from '../../services/navigator.service'; +import { MasternodesService } from '../../services/masternodes.service'; +import { ErrorService } from '../../services/error.service'; +import { Observable } from 'rxjs'; + +import { NO_ERRORS_SCHEMA, } from '@angular/core'; describe('MasternodeDetailsComponent', () => { let component: MasternodeDetailsComponent; let fixture: ComponentFixture; + const navigatorServiceSpy: jasmine.SpyObj = jasmine.createSpyObj('NavigatorService', ['']); + const masternodesServiceSpy: jasmine.SpyObj = jasmine.createSpyObj('MasternodesService', ['getByIP']); + const errorServiceSpy: jasmine.SpyObj = jasmine.createSpyObj('ErrorService', ['renderServerErrors']); + beforeEach(async(() => { + masternodesServiceSpy.getByIP.and.returnValue(Observable.create()); + TestBed.configureTestingModule({ - declarations: [ MasternodeDetailsComponent ] + declarations: [ + MasternodeDetailsComponent, + ExplorerDatetimePipe + ], + imports: [ + MomentModule, + TranslateModule.forRoot(), + RouterTestingModule + ], + providers: [ + { provide: NavigatorService, useValue: navigatorServiceSpy }, + { provide: MasternodesService, useValue: masternodesServiceSpy }, + { provide: ErrorService, useValue: errorServiceSpy } + ], + schemas: [NO_ERRORS_SCHEMA] }) .compileComponents(); }));