26 lines
874 B
TypeScript
26 lines
874 B
TypeScript
import React from 'react'
|
|
import { render } from '@testing-library/react'
|
|
import CategoryImage from './CategoryImage'
|
|
import formPublish from '../../data/form-publish.json'
|
|
|
|
describe('CategoryImage', () => {
|
|
it('renders fallback image', () => {
|
|
const { container } = render(<CategoryImage category={''} />)
|
|
expect(container.firstChild).toBeInTheDocument()
|
|
expect(container.firstChild.style.backgroundImage).toMatch(
|
|
/jellyfish-back/
|
|
)
|
|
})
|
|
|
|
it('renders all the category images', () => {
|
|
const { options } = formPublish.steps[1].fields
|
|
? formPublish.steps[1].fields.categories
|
|
: []
|
|
|
|
options.map((category: string) => {
|
|
const { container } = render(<CategoryImage category={category} />)
|
|
expect(container.firstChild).toBeInTheDocument()
|
|
})
|
|
})
|
|
})
|