1
0
mirror of https://github.com/kremalicious/portfolio.git synced 2024-06-10 11:25:24 +02:00
portfolio/src/components/molecules/LogoUnit.test.jsx
2019-11-10 14:40:45 +01:00

36 lines
988 B
JavaScript

import React from 'react'
import { render } from '@testing-library/react'
import { useStaticQuery } from 'gatsby'
import LogoUnit from './LogoUnit'
import data from '../../../jest/__fixtures__/meta.json'
beforeEach(() => {
useStaticQuery.mockImplementationOnce(() => {
return {
...data
}
})
})
describe('LogoUnit', () => {
it('renders correctly from data file values', () => {
const { title, tagline } = data.metaYaml
const { container } = render(<LogoUnit />)
expect(container.firstChild).toBeInTheDocument()
expect(container.querySelector('.title')).toHaveTextContent(
title.toLowerCase()
)
expect(container.querySelector('.description')).toHaveTextContent(
tagline.toLowerCase()
)
})
it('renders in minimal variant', () => {
const { container } = render(<LogoUnit minimal={true} />)
expect(container.firstChild).toBeInTheDocument()
expect(container.querySelector('.minimal')).toBeInTheDocument()
})
})