While working on unit testing, I encountered the following 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 seeing an error within the expect(this) part. Can you help me identify the mistake here?
Your assistance would be greatly appreciated.