Add blogpost page and cell

This commit is contained in:
Kurt Hutten
2020-10-10 12:18:23 +11:00
parent 029d6f4efc
commit 1a8bea1b85
9 changed files with 108 additions and 1 deletions

View File

@@ -0,0 +1,26 @@
import { render, screen } from '@redwoodjs/testing'
import { Loading, Empty, Failure, Success } from './BlogPostCell'
import { standard } from './BlogPostCell.mock'
describe('BlogPostCell', () => {
test('Loading renders successfully', () => {
render(<Loading />)
// Use screen.debug() to see output
expect(screen.getByText('Loading...')).toBeInTheDocument()
})
test('Empty renders successfully', async () => {
render(<Empty />)
expect(screen.getByText('Empty')).toBeInTheDocument()
})
test('Failure renders successfully', async () => {
render(<Failure error={new Error('Oh no')} />)
expect(screen.getByText(/Oh no/i)).toBeInTheDocument()
})
test('Success renders successfully', async () => {
render(<Success blogPost={standard().blogPost} />)
expect(screen.getByText(/42/i)).toBeInTheDocument()
})
})