1
0
mirror of https://github.com/kremalicious/portfolio.git synced 2024-10-31 23:35:29 +01:00
portfolio/src/components/organisms/Header.test.jsx

23 lines
688 B
JavaScript

import React from 'react'
import { render } from 'react-testing-library'
import { StaticQuery, useStaticQuery } from 'gatsby'
import Header from './Header'
import { Provider } from '../../store/createContext'
import data from '../../../jest/__fixtures__/meta.json'
describe('Header', () => {
beforeEach(() => {
StaticQuery.mockImplementation(({ render }) => render({ ...data }))
useStaticQuery.mockImplementation(() => ({ ...data }))
})
it('renders correctly', () => {
const { container } = render(
<Provider value={{ dark: false, toggleDark: () => null }}>
<Header />
</Provider>
)
expect(container.firstChild).toBeInTheDocument()
})
})