Skip to content

Instantly share code, notes, and snippets.

@ifndefdeadmau5
Last active January 1, 2022 08:31
Show Gist options
  • Save ifndefdeadmau5/addef61a6de25d08599676661a6a3be5 to your computer and use it in GitHub Desktop.
Save ifndefdeadmau5/addef61a6de25d08599676661a6a3be5 to your computer and use it in GitHub Desktop.
flaky-test.js
import '@testing-library/jest-dom/extend-expect'
import * as React from 'react'
import {render, screen} from '@testing-library/react'
import userEvent from '@testing-library/user-event'
import SimpleList from '../SimpleList'
test('can remove items from the list', () => {
render(<SimpleList />)
const deleteButton = fireEvent.click(screen.queryAllByTestId('delete-button')[0] as HTMLElement)
userEvent.click(deleteButton)
expect(deleteButton).not.toBeInTheDocument()
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment