Unit Testing
Introduction
- 22 Video Course on scrimba
Why Unit Test?
- Code Confidence
- Supports test driven development
- In demand skill
- Makes life easier
Intro to Jasmine
Jasmine - Behavior Driven JavaScript
- Jasmine is a behavior driven dev framework for testing JS code
Other JS Testing Frameworks
- Jest
- Mocha & Chai
- Protractor & Cypress
What makes Jasmine Special?
- No External Dependencies
- Front-End/Back-End testing
- Simple
Jasmine Docs (opens in a new tab)
Setting Up Jasmine from Scratch
- Essentially adding scripts and neccessary html and css files.
- This course only covers Unit Testing ideology itself, not full on applications.
- Below is a link that helps set up unit testing with React.
Unit Testing w/React (opens in a new tab)
Understanding the 3 Parts of Testing
- Describe block, grouping
- test
- expectation and matcher
Testing Setup Breakdown
- Breaking down high-level overview of what each file is doing
Grouping with Describe
- Way to group your test
main.js
...
describe('User', () => {
});
...
- More reliable way to identify our grouping name?
main.js
...
describe(`${User.name} Class`, () => {
});
...