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/components/layout/layout.spec.tsx

26 lines
687 B

import { render } from '@testing-library/react';
import Layout from './layout';
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('Layout', () => {
it('should render successfully', () => {
const { baseElement } = render(<Layout />);
expect(baseElement).toBeTruthy();
});
});