1
0
Fork 0
blog/src/components/templates/Posts.test.tsx

29 lines
680 B
TypeScript
Raw Normal View History

2019-11-24 14:29:25 +01:00
import React from 'react'
import { render } from '@testing-library/react'
import { createHistory, createMemorySource } from '@reach/router'
import Posts from './Posts'
2020-03-04 22:21:12 +01:00
import data from '../../../jest/__fixtures__/posts.json'
2019-11-24 14:29:25 +01:00
describe('Post', () => {
const history = createHistory(createMemorySource('/photos'))
const pageContext = {
tag: 'hello',
slug: '/hello',
currentPageNumber: 2,
numPages: 20
}
it('renders without crashing', () => {
const { container } = render(
<Posts
data={data}
pageContext={pageContext}
location={history.location}
/>
)
expect(container.firstChild).toBeInTheDocument()
})
})