import React from 'react';
import { render, cleanup } from '@testing-library/react';
import '@testing-library/jest-dom/extend-expect';

import '~tests/helpers/match-media.mock';
import MainProvider from '~context/MainProvider';
import Body from '.';

function renderComponent() {
  return render(
    <MainProvider
      value={{
        bannerIsActive: false,
        cookieAccepted: true,
      }}
    >
      <Body
        pageContext={{
          page: { sections: {} },
          marketSections: {},
        }}
      />
    </MainProvider>
  );
}

describe('Body', () => {
  test('renders without crash', () => {
    const { container } = renderComponent();
    // all sections have their own test, we only need to test body renders without crash
    expect(container).toBeTruthy();
    expect(container.querySelector('.scrollToTop')).toBeTruthy();
  });
});
afterEach(() => {
  cleanup();
});
