- React is a library - no battery included
- SPA ?
Unit testing
Runner
- Test runtime - runs parsed test
- Karma - most popular UI runner?
Testing library
- Parses the test and gives it to the runner
- Jasmine, react test library
Assertion library
- assert4j, hamcrust, chai, mocha, jasmine, jest
Jest include a runner, a testing library and an assertion library
Testing in js
- Js
- Jquery - js + wrapper
- ecma script standard (es6, …)
- es6 introduced arrow functions
- How will browser run diff ecma scripts? older browsers versions
- Babel - a transpiler - takes all ecma scripts and converts it into js
- Minification - remove all trailing spaces
- Uglyfy - optimize variable names - sourceSet
- Enitre app is in one page in SPAs
- chunking
- some modules are indepent of all other - angular
- react - vendor.js main all others are lazy loded
- done by build tools - webpack, gulp, grunt
npx eject
- React - one level above ecma script
Framework -> Ecma script -> Babel how to do it -> Tell Webpack how to do it
- 302 http status - already present
ui testing types,
- functional testing
- user flow testing
Enzyme - introduced two testing types - in framework today
- shallow
- mount - actually build dom
shallow test - does not need dom mount - needs dom
for mount - have to inform runner (as webpack conf) to use js dom
js dom - headless dom
two highlevel js - one for frontend, one for node
play - next js for backend
setup react the old way