/testing-rtl

Primary LanguageJavaScript

Getting Started with Create React App

This project was bootstrapped with Create React App.

Notes - AB

Assertions

  • these will determine the test pass or fail expect(linkElement).toBeInTheDocument();

expect -- jest global method expect() -- jet will examine .toBeInTheDocument -- matches comes from jest dom () - sometime these matches have argument

jest-dom are dom based matcher can be applied to the virtual dom. (toBeInTheDocument)

  • these are dom based matcher can't be applied to node code */

JEST - an test runner

RTL (react testing library) -> render component in virtual dom - render() -> searcging virtual dom - screen() -> interacting with virtual dom - fireEvent() -> need a test runner (jest is recommend by rtl)

Available Scripts

In the project directory, you can run:

yarn start

Runs the app in the development mode.
Open http://localhost:3000 to view it in the browser.

The page will reload if you make edits.
You will also see any lint errors in the console.

yarn test

Launches the test runner in the interactive watch mode.
See the section about running tests for more information.