विफल होने के कारण मैं एक नेस्टेड घटक में टूलटिप्स और मॉडल्स का उपयोग कर रहा हूं, और मेरी spec फ़ाइल में, मैं परीक्षण मॉड्यूल में NgbModule.forRoot()
आयात कर रहा हूं।घटक में NgbModule.forRoot() का उपयोग करने के कारण परीक्षण
यह इस एक घटक को छोड़कर हर जगह काम करने के लिए लगता है, और अगर मैं इस आयात जोड़ने के लिए, मेरी इकाई परीक्षण के कई अचानक इस त्रुटि के साथ विफल शुरू: मैं bundling के लिए कोणीय CLI उपयोग कर रहा हूँ
TypeError: this._unregisterListenersFn is not a function
at NgbTooltip.ngOnDestroy
/परिक्षण।
यह एकमात्र घटक है जो मेरे परीक्षणों में विफल रहा है।
मैंने टूलटिप/मोडल मॉड्यूल को अलग से आयात करने और उनके प्रासंगिक प्रदाताओं को अलग से आयात करने का प्रयास किया है और यह ऊपर की त्रुटि प्राप्त कर रहा है। अगर मैं forRoot()
के बिना कोशिश करता हूं, तो मुझे DI त्रुटियां मिलती हैं।
मुझे कोई संकेत नहीं है कि समस्या क्या है।
यहाँ कल्पना फ़ाइल है:
/* tslint:disable:no-unused-variable */
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { By } from '@angular/platform-browser';
import { DebugElement } from '@angular/core';
import { APP_BASE_HREF } from '@angular/common';
import { RouterTestingModule } from '@angular/router/testing';
import { NgbModule, NgbTooltipModule, NgbTooltipConfig, NgbModalModule } from '@ng-bootstrap/ng-bootstrap';
import { NgbModalStack } from '@ng-bootstrap/ng-bootstrap/modal/modal-stack';
import { ListItemComponent } from './list-item.component';
import { VideoPlayerService } from '../../../video-player';
import { CalendarRoutingService } from '../../calendar-routing.service';
describe('ListItemComponent',() => {
let component: ListItemComponent;
let fixture: ComponentFixture<ListItemComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [
ListItemComponent
],
imports: [RouterTestingModule, NgbModule.forRoot()],
providers: [
VideoPlayerService,
CalendarRoutingService,
// NgbModalStack,
// NgbTooltipConfig
]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(ListItemComponent);
component = fixture.componentInstance;
component.item = { records: [] };
fixture.detectChanges();
});
it('should create',() => {
expect(component).toBeTruthy();
});
});