Trying to use jest to write a unit test for the following function, up untill now i have been exporting functions outside of the class to test, my problem now is a function is within a class and i dont know how to properly test it. The below handleRequest is within a class
handleRequestSort(event, property) {
const orderBy = property;
let order = 'desc';
if (this.state.orderBy === property && this.state.order === 'desc') {
order = 'asc';
}
this.setState({ order, orderBy });
}
describe('Test for handleRequestSort', () => {
it('should handle the sorting of a request', () => {
const ordering = Contract.handleRequestSort(null, 'name');
expect(ordering).toEqual('name');
});
});