You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import'@testing-library/jest-dom/extend-expect'importReactfrom'react'import{render,fireEvent,screen}from'@testing-library/react'
<!-- or -->
import{render}from'@testing-library/react';render(...)expect(screen.queryByText(...))...fireEvent.click(...)expect(screen.getByText(...))...
Tutorials I'm following:
Newer: @testing-library/react built into create-react-app
react-testing-library -> testing (see .test.js file in tests folder) -> render(...), Simulate.click(...), await wait(...):
in turn, render(...) gives you: getByText, queryByText, getByTestId, queryByTestId, container, etc.
Run tests
yarn # just once
yarn test# -> will automatically re-run when you hit save
Run demo
yarn # if you haven't already
yarn start # -> https://localhost:3000
You can generate a dependency graph with bash show_dep_graph.sh.
You can publish a live site to surge with bash publish_live_site.sh (Just go into the relevant enclosing src or public folder of your site files - a CNAME file is there for convenience).