2019-04-15 00:25:54 +02:00
|
|
|
import React from 'react'
|
2019-05-30 22:55:12 +02:00
|
|
|
import { render } from '@testing-library/react'
|
2019-04-15 00:25:54 +02:00
|
|
|
import { useStaticQuery } from 'gatsby'
|
|
|
|
import { useMeta } from './use-meta'
|
|
|
|
import data from '../../jest/__fixtures__/meta.json'
|
|
|
|
|
|
|
|
beforeEach(() => {
|
2019-04-16 21:21:01 +02:00
|
|
|
useStaticQuery.mockImplementationOnce(() => ({ ...data }))
|
2019-04-15 00:25:54 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
describe('useMeta', () => {
|
|
|
|
it('renders correctly', () => {
|
|
|
|
const { social } = useMeta()
|
|
|
|
const { container } = render(<div>{social.Twitter}</div>)
|
|
|
|
|
|
|
|
expect(container.textContent).toBe('https://twitter.com/kremalicious')
|
|
|
|
})
|
|
|
|
})
|