From 417667df43cac77d4a6b850deb5c783e65845144 Mon Sep 17 00:00:00 2001 From: jonsadev Date: Fri, 18 Jan 2019 16:18:55 -0700 Subject: [PATCH] web-ui: Fix block-details.component.spec --- .../block-details.component.spec.ts | 31 ++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/web-ui/src/app/components/block-details/block-details.component.spec.ts b/web-ui/src/app/components/block-details/block-details.component.spec.ts index 1c3ef91..0f41966 100644 --- a/web-ui/src/app/components/block-details/block-details.component.spec.ts +++ b/web-ui/src/app/components/block-details/block-details.component.spec.ts @@ -1,14 +1,43 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { BlockDetailsComponent } from './block-details.component'; +import { ExplorerCurrencyPipe } from '../../pipes/explorer-currency.pipe'; +import { ExplorerDatetimePipe } from '../../pipes/explorer-datetime.pipe'; + +import { RouterTestingModule } from '@angular/router/testing'; +import { TranslateModule } from '@ngx-translate/core'; + +import { BlocksService } from './../../services/blocks.service'; +import { ErrorService } from '../../services/error.service'; +import { Observable } from 'rxjs'; + +import { NO_ERRORS_SCHEMA, } from '@angular/core'; describe('BlockDetailsComponent', () => { let component: BlockDetailsComponent; let fixture: ComponentFixture; + const blocksServiceSpy: jasmine.SpyObj = jasmine.createSpyObj('BlocksService', ['get', 'getTransactionsV2']); + const errorServiceSpy: jasmine.SpyObj = jasmine.createSpyObj('ErrorService', ['renderServerErrors']); + beforeEach(async(() => { + blocksServiceSpy.get.and.returnValue(Observable.create()); + TestBed.configureTestingModule({ - declarations: [ BlockDetailsComponent ] + declarations: [ + BlockDetailsComponent, + ExplorerCurrencyPipe, + ExplorerDatetimePipe + ], + imports: [ + RouterTestingModule, + TranslateModule.forRoot() + ], + providers: [ + { provide: BlocksService, useValue: blocksServiceSpy }, + { provide: ErrorService, useValue: errorServiceSpy } + ], + schemas: [NO_ERRORS_SCHEMA] }) .compileComponents(); }));