React Testing and Deployment - andrewkyllo-401-advanced-javascript/seattle-javascript-401d34 GitHub Wiki

Reach Testing

  • Snapshots - Make assertions on the exact rendered markup at any state of the application
  • Render Testing - Similar to snapshots, but allows for jQuery-like inspection of the virtual DOM tree
  • Shallow Testing - Executes and renders the called/container component, but does not compose of children
  • Mounting - Executes the full component and children. Allows for inspection of rendered Virtual DOM as well as the current state

Deployment

  • npm run build executes from the root folder of your Reach application which outputs a static website.

Deploying to GitHub Pages

  1. Enable GitHub Pages on your domain, using the gh-pages branch
  2. Create a Personal Access Token in your GitHub account
  3. Add this token as a "Secret" called PERSONAL_TOKEN in the repository housing your react app
  4. Add the react workflow .yml file to your repository (in .github/workflows) This will initiate a GitHub Action whenever you push, will run the build command creating a new branch called gh-pages` and deploy your React static files to that branch