You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nx-guitar-school/apps/website/pages/index.spec.tsx

27 lines
710 B

import React from 'react';
import {render} from '@testing-library/react';
import Index from '../pages/index';
jest.mock("next-auth/react", () => {
const originalModule = jest.requireActual('next-auth/react');
const mockSession = {
expires: new Date(Date.now() + 2 * 86400).toISOString(),
user: {username: "admin"}
};
return {
__esModule: true,
...originalModule,
useSession: jest.fn(() => {
return {data: mockSession, status: 'authenticated'} // return type is [] in v3 but changed to {} in v4
}),
};
});
describe('Index', () => {
it('should render successfully', () => {
const {baseElement} = render(<Index/>);
expect(baseElement).toBeTruthy();
});
});