diff --git a/web-ui/src/app/components/finder/finder.component.spec.ts b/web-ui/src/app/components/finder/finder.component.spec.ts index 7ba4a1d..0247312 100644 --- a/web-ui/src/app/components/finder/finder.component.spec.ts +++ b/web-ui/src/app/components/finder/finder.component.spec.ts @@ -2,13 +2,65 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { FinderComponent } from './finder.component'; +import { TranslateModule } from '@ngx-translate/core'; + +import { TranslateService } from '@ngx-translate/core'; +import { FormBuilder, FormGroup, Validators } from '@angular/forms'; +import { NavigatorService } from '../../services/navigator.service'; +import { AddressesService } from '../../services/addresses.service'; +import { BlocksService } from '../../services/blocks.service'; +import { MasternodesService } from '../../services/masternodes.service'; +import { TransactionsService } from '../../services/transactions.service'; +import { ErrorService } from '../../services/error.service'; + +import { NO_ERRORS_SCHEMA, } from '@angular/core'; + +import { Observable } from 'rxjs'; + describe('TransactionFinderComponent', () => { let component: FinderComponent; let fixture: ComponentFixture; + const navigatorServiceSpy: jasmine.SpyObj = jasmine.createSpyObj('NavigatorService', [ + 'addressDetails', + 'transactionDetails', + 'masternodeDetails', + 'blockDetails' + ]); + const addressesServiceSpy: jasmine.SpyObj = jasmine.createSpyObj('AddressesService', ['get']); + const blocksServiceSpy: jasmine.SpyObj = jasmine.createSpyObj('BlocksService', ['get']); + const masternodesServiceSpy: jasmine.SpyObj = jasmine.createSpyObj('MasternodesService', ['getByIP']); + const transactionsServiceSpy: jasmine.SpyObj = jasmine.createSpyObj('TransactionsService', ['get']); + const errorServiceSpy: jasmine.SpyObj = jasmine.createSpyObj('ErrorService', [ + 'setFieldError', + 'hasCorrectValue', + 'hasWrongValue', + 'getFieldError']); + beforeEach(async(() => { + addressesServiceSpy.get.and.returnValue(Observable.create()); + blocksServiceSpy.get.and.returnValue(Observable.create()); + masternodesServiceSpy.getByIP.and.returnValue(Observable.create()); + transactionsServiceSpy.get.and.returnValue(Observable.create()); + TestBed.configureTestingModule({ - declarations: [ FinderComponent ] + declarations: [ + FinderComponent + ], + imports: [ + TranslateModule.forRoot() + ], + providers: [ + FormBuilder, + TranslateService, + { provide: NavigatorService, useValue: navigatorServiceSpy }, + { provide: AddressesService, useValue: addressesServiceSpy }, + { provide: BlocksService, useValue: blocksServiceSpy }, + { provide: MasternodesService, useValue: masternodesServiceSpy }, + { provide: TransactionsService, useValue: transactionsServiceSpy }, + { provide: ErrorService, useValue: errorServiceSpy } + ], + schemas: [NO_ERRORS_SCHEMA] }) .compileComponents(); }));