Using @robrich's test code (https://github.com/robrich/web-test-everything) and @bornasepic's tic-tac-toe application code (https://github.com/BornaSepic/Tic-Tac-Toe) to learn about a flurry of things all at once, including but not limited to:
- JS Web Development
- Testing JS
- Typescript
- Vue
This is the companion code to the talk at https://robrich.org/slides/web-test-all-the-things/
In this talk we look at testing TypeScript Web Apps (PWA / SPA). We examine tests in these categories:
- hello testing typescript
- unit test a function
- without mocks
- mock dependencies
- mock parameters
- unit test a component
- assert rendering
- assert behaviors
- integration testing (from here down)
- external API validation
- end-to-end UI tests
- custom commands
- mock network requests
- smoke tests
We explore these NPM packages:
-
Start redis in docker by running
docker-compose up
-
Start api by running this from a terminal:
cd api npm install npm start
-
Start the vue app by running this from a terminal:
cd app npm install npm run serve
-
Start redis in docker by running
docker-compose up
-
Don't start the app or api, and kill them if they're running
-
From a terminal run this:
cd api npm run test cd .. cd app npm run test cd ..
See also the GitHub Actions build file in .github/workflows/build-and-test.yaml
MIT