2019-04-28 15:01:38 +02:00
|
|
|
import React from 'react'
|
|
|
|
import { render } from 'react-testing-library'
|
|
|
|
import { StaticQuery } from 'gatsby'
|
|
|
|
import Home from '../index'
|
|
|
|
import meta from '../../../jest/__fixtures__/meta.json'
|
|
|
|
import projects from '../../../jest/__fixtures__/projects.json'
|
|
|
|
import projectImageFiles from '../../../jest/__fixtures__/projectImageFiles.json'
|
|
|
|
|
|
|
|
beforeEach(() => {
|
|
|
|
StaticQuery.mockImplementation(({ render }) => render({ ...meta }))
|
|
|
|
})
|
|
|
|
|
|
|
|
describe('Home', () => {
|
|
|
|
const data = {
|
|
|
|
...projects,
|
|
|
|
...projectImageFiles
|
|
|
|
}
|
|
|
|
|
2019-05-26 22:20:16 +02:00
|
|
|
const pageContext = {
|
|
|
|
repos: [
|
|
|
|
{
|
|
|
|
name: 'Hello'
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
|
2019-04-28 15:01:38 +02:00
|
|
|
it('renders correctly from data file values', () => {
|
2019-05-26 22:20:16 +02:00
|
|
|
const { container } = render(<Home data={data} pageContext={pageContext} />)
|
2019-04-28 15:01:38 +02:00
|
|
|
expect(container.firstChild).toBeInTheDocument()
|
|
|
|
})
|
|
|
|
})
|