Skip to content

Commit

Permalink
web-ui: Fix finder.component.spec
Browse files Browse the repository at this point in the history
  • Loading branch information
JonSalazar committed Jan 21, 2019
1 parent ce358d7 commit 22ced16
Showing 1 changed file with 53 additions and 1 deletion.
54 changes: 53 additions & 1 deletion web-ui/src/app/components/finder/finder.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<FinderComponent>;

const navigatorServiceSpy: jasmine.SpyObj<NavigatorService> = jasmine.createSpyObj('NavigatorService', [
'addressDetails',
'transactionDetails',
'masternodeDetails',
'blockDetails'
]);
const addressesServiceSpy: jasmine.SpyObj<AddressesService> = jasmine.createSpyObj('AddressesService', ['get']);
const blocksServiceSpy: jasmine.SpyObj<BlocksService> = jasmine.createSpyObj('BlocksService', ['get']);
const masternodesServiceSpy: jasmine.SpyObj<MasternodesService> = jasmine.createSpyObj('MasternodesService', ['getByIP']);
const transactionsServiceSpy: jasmine.SpyObj<TransactionsService> = jasmine.createSpyObj('TransactionsService', ['get']);
const errorServiceSpy: jasmine.SpyObj<ErrorService> = 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();
}));
Expand Down

0 comments on commit 22ced16

Please sign in to comment.