How to test an export function which has req as parameter in react

I’m really new to react and I’ve given a code to test.

export function getServerSideProps({ req }) {
  return {
    props: {

export default function DailyProfit(props) {
  const [pageErrors, setPageErrors] = useState([]);

  return (
      heading="Profit page"
      <HmpoDatePicker {...props} errorCallback={setPageErrors} />

How can I test the first export function getServerSideProps I’m really stuck and any help will be appreciated. Thanks


import {getServerSideProps} from 'file_name';

describe('getServerSideProps', () => {
  test('returns properties from request properties', () => {
    const request = {
      properties: { profit: 'someProfit' }
    expect(getServierSideProps({req: request}).props.profit).toEqual(;

You just call the function with mocked argument so that you are sure that getServerSideProps function correctly parses the given object.

Note that above example is written used the jest test runner