import { CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA } from '@angular/core'; import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { ConfigService } from '@arrow/bom/config'; import { CartHandoverService, Utils } from '@arrow/bom/core'; import { CurrencyConverterPipe, SharedModule } from '@arrow/bom/shared'; import { of } from 'rxjs'; import { BomPartQuantityComponent } from './bom-part-quantity.component'; const mockCurrencyConverterPipe: Partial = { transform: (val: number) => { return of(val); } }; describe('BomPartQuantityComponent', () => { let component: BomPartQuantityComponent; let fixture: ComponentFixture; beforeEach(async(() => { const configServiceSpyObj = jasmine.createSpyObj('ConfigService', ['getTarget']); const utilsSpyObj = jasmine.createSpyObj('Utils', ['getCurrencySymbol']); TestBed.configureTestingModule({ schemas: [NO_ERRORS_SCHEMA, CUSTOM_ELEMENTS_SCHEMA], imports: [ SharedModule, // This is needed to resolve CurrencyConverterPipe instantiation issue ], declarations: [ BomPartQuantityComponent ], providers:[ // Below 4 were needed to resolve CurrencyConverterPipe instantiation issue { provide: CurrencyConverterPipe, useValue: mockCurrencyConverterPipe }, { provide: CartHandoverService, useValue: {} }, { provide: ConfigService, useValue: configServiceSpyObj }, { provide: Utils, useValue: utilsSpyObj } ] }).compileComponents(); })); beforeEach(() => { fixture = TestBed.createComponent(BomPartQuantityComponent); component = fixture.componentInstance; component.row = { item : {} } fixture.detectChanges(); }); it('should create', () => { expect(component).toBeTruthy(); }); });