Angular2 Flux + Webpack + Karma example
Includes karma configuration to run with typescript files and angular2/testing
Uses immutable.js collections for more efficient change detection in stores
Examples of tests for actions/ stores/ components with externally injected dependencies (including Http.get spy example)
- Install dependencies and start compiling:
npm install
- Optionally run if you want to watch for changes in the file system - e.g. when editing
./node_modules/.bin/webpack --watch
- Optionally start the static resources server (and visit http://localhost:8080
npm start
or use a server of your choice and open index.html in any browser
- example of Component testing: TestComponentBuilder.overrideProviders() and TestComponentBuilder.overrideTemplate() (counter module)
- example of testing Components with FormBuilder (login module)
- example of testing actions (counter module)
- example of testing stores (counter module)
Consider using web api utils to abstract away http calls from the actions (which should be responsible for caching too) e.g. web api utils (Flux concept)