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

32 lines
972 B
React
Raw Normal View History

2019-04-16 21:21:01 +02:00
import React from 'react'
2019-05-30 22:55:12 +02:00
import { render } from '@testing-library/react'
2019-04-16 21:21:01 +02:00
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()
})
2019-04-28 15:01:38 +02:00
it('Availability can be hidden', () => {
const { container } = render(
<Provider value={{ dark: false, toggleDark: () => null }}>
<Header minimal={true} />
</Provider>
)
expect(container.querySelector('.availability')).not.toBeInTheDocument()
})
2019-04-16 21:21:01 +02:00
})