started on November 14, 2021
render(<App />)
: virtual DOMscreen.*
: select element(s) from the V/ DOMfireEvent
: event handling
most importantly, a big take from here will be about ARIA(Accessible Rich Internet Applications)
screen.getByRole
W3C Role Definitionsexpect.toHaveStyle
expect.toBeEnabled
,expect.toBeDisabled
expect.not.toBeChecked
- when a function is used in multiple files
- when a function has too many edge cases
describe
> can have multiple test functions inside
-
Test interactivity using
fireEvent
-
jest-dom assertions:
toBeEnabled()
toBeDisabled()
toBeChecked()
-
getByRole
option{ name: }
-
Jest
describe to group tests -
Unit testing functions - a function in a component is too complicated so you don't want to render it multiple times (theoratically)