单元测试用例失败,并且下面提到的测试用例出错。 HTML的标题(表格标题名称)和表格(日期日期和tr-paymentdate)目前由于没有服务而为空。如何克服这个未定义的问题?
HTML.TS
<div>
<h2>{{ 'table heading name' | translate }} </h2>
</div>
.
.
.
<th >
<span id="ColumnName">{{ 'date' | translate }}</span>
</th>
.
.
<td>
<span>{{'paymentdate' | translate}}</span>
</td>
SPEC.TS
...
...
...
it('should render Payment heading in h2 tag', () => {
const fixture = TestBed.createComponent(TestingComponent);
fixture.detectChanges();
const compiled = fixture.debugElement.nativeElement;
expect(compiled.querySelectorAll('h2')[0].textContent).toBe('table heading name');
});