Updates tests to 0.21.0 style assertions

This commit is contained in:
Rob Cameron
2020-10-26 16:52:15 -07:00
parent ef82a59b6e
commit 7e74567326
2 changed files with 18 additions and 14 deletions

View File

@@ -4,19 +4,21 @@ import { standard } from './BlogPostCell.mock'
describe('BlogPostCell', () => { describe('BlogPostCell', () => {
test('Loading renders successfully', () => { test('Loading renders successfully', () => {
expect(() => {
render(<Loading />) render(<Loading />)
// Use screen.debug() to see output }).not.toThrow()
expect(screen.getByText('Loading...')).toBeInTheDocument()
}) })
test('Empty renders successfully', async () => { test('Empty renders successfully', async () => {
expect(() => {
render(<Empty />) render(<Empty />)
expect(screen.getByText('Empty')).toBeInTheDocument() }).not.toThrow()
}) })
test('Failure renders successfully', async () => { test('Failure renders successfully', async () => {
expect(() => {
render(<Failure error={new Error('Oh no')} />) render(<Failure error={new Error('Oh no')} />)
expect(screen.getByText(/Oh no/i)).toBeInTheDocument() }).not.toThrow()
}) })
test('Success renders successfully', async () => { test('Success renders successfully', async () => {

View File

@@ -4,19 +4,21 @@ import { standard } from './BlogPostsCell.mock'
describe('BlogPostsCell', () => { describe('BlogPostsCell', () => {
test('Loading renders successfully', () => { test('Loading renders successfully', () => {
expect(() => {
render(<Loading />) render(<Loading />)
// Use screen.debug() to see output }).not.toThrow()
expect(screen.getByText('Loading...')).toBeInTheDocument()
}) })
test('Empty renders successfully', async () => { test('Empty renders successfully', async () => {
expect(() => {
render(<Empty />) render(<Empty />)
expect(screen.getByText('Empty')).toBeInTheDocument() }).not.toThrow()
}) })
test('Failure renders successfully', async () => { test('Failure renders successfully', async () => {
expect(() => {
render(<Failure error={new Error('Oh no')} />) render(<Failure error={new Error('Oh no')} />)
expect(screen.getByText(/Oh no/i)).toBeInTheDocument() }).not.toThrow()
}) })
test('Success renders successfully', async () => { test('Success renders successfully', async () => {