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.
26 lines
699 B
26 lines
699 B
import {render} from '@testing-library/react';
|
|
|
|
import Header from '../components/header/header';
|
|
|
|
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('Header', () => {
|
|
it('should render successfully', () => {
|
|
const {baseElement} = render(<Header/>);
|
|
expect(baseElement).toBeTruthy();
|
|
});
|
|
});
|