From 56ff5bf94da1b641daae100531d2b9f6557ec1e9 Mon Sep 17 00:00:00 2001 From: jonsadev Date: Mon, 21 Jan 2019 10:36:08 -0700 Subject: [PATCH] web-ui: Fix transaction-details.component.spec --- .../transaction-details.component.spec.ts | 34 ++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/web-ui/src/app/components/transaction-details/transaction-details.component.spec.ts b/web-ui/src/app/components/transaction-details/transaction-details.component.spec.ts index e99fd50..0e4b96f 100644 --- a/web-ui/src/app/components/transaction-details/transaction-details.component.spec.ts +++ b/web-ui/src/app/components/transaction-details/transaction-details.component.spec.ts @@ -1,14 +1,46 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { TransactionDetailsComponent } from './transaction-details.component'; +import { ExplorerDatetimePipe } from '../../pipes/explorer-datetime.pipe'; +import { ExplorerCurrencyPipe } from '../../pipes/explorer-currency.pipe'; + +import { TranslateModule } from '@ngx-translate/core'; +import { RouterTestingModule } from '@angular/router/testing'; + +import { NavigatorService } from '../../services/navigator.service'; +import { TransactionsService } from '../../services/transactions.service'; +import { ErrorService } from '../../services/error.service'; +import { Observable } from 'rxjs'; + +import { NO_ERRORS_SCHEMA, } from '@angular/core'; describe('TransactionDetailsComponent', () => { let component: TransactionDetailsComponent; let fixture: ComponentFixture; + const navigatorServiceSpy: jasmine.SpyObj = jasmine.createSpyObj('NavigatorService', ['']); + const transactionsServiceSpy: jasmine.SpyObj = jasmine.createSpyObj('TransactionsService', ['get']); + const errorServiceSpy: jasmine.SpyObj = jasmine.createSpyObj('ErrorService', ['renderServerErrors']); + beforeEach(async(() => { + transactionsServiceSpy.get.and.returnValue(Observable.create()); + TestBed.configureTestingModule({ - declarations: [ TransactionDetailsComponent ] + declarations: [ + TransactionDetailsComponent, + ExplorerDatetimePipe, + ExplorerCurrencyPipe + ], + imports: [ + TranslateModule.forRoot(), + RouterTestingModule + ], + providers: [ + { provide: NavigatorService, useValue: navigatorServiceSpy }, + { provide: TransactionsService, useValue: transactionsServiceSpy }, + { provide: ErrorService, useValue: errorServiceSpy }, + ], + schemas: [NO_ERRORS_SCHEMA] }) .compileComponents(); }));