Fix BlogPost test
This commit is contained in:
@@ -1,11 +1,18 @@
|
||||
import { render } from '@redwoodjs/testing'
|
||||
import { render, screen } from '@redwoodjs/testing'
|
||||
|
||||
import BlogPost from './BlogPost'
|
||||
|
||||
describe('BlogPost', () => {
|
||||
it('renders successfully', () => {
|
||||
expect(() => {
|
||||
render(<BlogPost post={{ id: 1, name: 'John Doe', body: 'Body' }} />)
|
||||
}).not.toThrow()
|
||||
it('renders a blog post', () => {
|
||||
const post = {
|
||||
id: 1,
|
||||
title: 'First post',
|
||||
body: 'Neutra tacos hot chicken prism raw denim...',
|
||||
createdAt: new Date().toISOString(),
|
||||
}
|
||||
render(<BlogPost post={post} />)
|
||||
|
||||
expect(screen.getByText(post.title)).toBeInTheDocument()
|
||||
expect(screen.getByText(post.body)).toBeInTheDocument()
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user