I was working on unit testing I am getting below error
Object is possibly 'undefined'
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');
})
I am getting error inside expect(this) what is the mistake here.
Please let me know.