Skip to content

Commit

Permalink
Fix jest test
Browse files Browse the repository at this point in the history
  • Loading branch information
cmdcolin committed Jul 8, 2024
1 parent 0249180 commit 0a754a3
Show file tree
Hide file tree
Showing 3 changed files with 383 additions and 422 deletions.
7 changes: 2 additions & 5 deletions src/HelloView/components/HelloView.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react'
import { render, fireEvent, waitFor, screen } from '@testing-library/react'
import { render, fireEvent, screen } from '@testing-library/react'
import '@testing-library/jest-dom'
import HelloView from './HelloView'

Expand All @@ -11,8 +11,5 @@ it('renders and reacts to button push', async () => {
)

fireEvent.click(screen.getByText('Push the button'))
const element = await waitFor(() =>
screen.getByText('Whoa! You pushed the button!'),
)
expect(element).toBeTruthy()
await screen.findByText('Whoa! You pushed the button!')
})
2 changes: 1 addition & 1 deletion src/HelloView/components/HelloView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default function ReactComponent() {
<h1>Hello plugin developers!</h1>
<button
onClick={() => {
setPushed('Whoa2! You pushed the button!')
setPushed('Whoa! You pushed the button!')
}}
>
Push the button
Expand Down
Loading

0 comments on commit 0a754a3

Please sign in to comment.