【发布时间】:2021-01-06 05:42:35
【问题描述】:
我正在做单元测试,但遇到错误
对象可能是“未定义”
it('should set the dataSource filter to the provided argument', () => {
component.applyFilter('filterValue');
expect(this.dataSource.filter).toEqual('filterValue');
})
it('should set the dataSource filter to the provided argument', () => {
component.applyFilter('filterValue');
expect(this.DMDataSource.filter).toEqual('filterValue');
})
我在 expect(this) 中遇到错误,这里的错误是什么。
请告诉我。
【问题讨论】:
-
M 先生:我的回答有帮助吗?
-
我打勾了我还有一个问题我问你能不能帮忙stackoverflow.com/questions/64058914/…
标签: angular typescript unit-testing jasmine karma-jasmine