/TourOfHeroes

Primary LanguageTypeScriptMIT LicenseMIT

Tour of Heros (Tested)

This is the Tour of Heroes example app fully tested using best practices. It can be used to learn better ways to test Angular components and services or as reference guide.

These are some of the concepts showcased in this repo:

  • Isolating the components
    • Stubbing dependencies
  • Isolating tests
    • Avoiding global variables
    • Testing the UI of the components, not the code
    • Reset components and dependencies before using them
    • Faking the clock instead of delaying tests
  • Using Jasmine blocks to organize the tests

For more information on testing each individual component check these articles:

Get the Code

git clone https://github.com/SimonTestNet/TourOfHeroes.git
cd TourOfHeroes
npm i

npm scripts

  • start: Run the app
  • test: Run the unit tests using Karma
  • coverage: Run the tests and generate a coverage report

Test Generator

https://marketplace.visualstudio.com/items?itemName=SimonTest.simontest