Cheatography
https://cheatography.com
Dos and Don'ts in a Domain-driven Design (DDD) environment also testing suggestions.
GLOBAL
One function does one thing |
|
Write module unit tests |
|
Nested if/else |
|
Write component (s)css |
|
FACADE
One facade per feature |
|
Extract logic from facade |
|
Subscribe |
|
STATE MANAGEMENT
ACTION |
Use enum for action name |
|
REDUCER |
Copy and write into state |
|
|
Write mapping or filter logic |
|
EFFECT |
Delegate actions |
|
|
Use mergeMap to to delegate one action into multiple |
|
|
Map server results |
|
|
contractLatestFrom store |
|
SELECTOR |
Read store value |
|
|
USE CASE specific mapping, filtering, sorting |
|
|
Chain selectors |
|
|
Mapping logic |
|
|
|
APPS
Register Modules |
|
Setup Theming (Colors and Typograhy) |
|
Add business logic |
|
DOMAIN / Infrastructure
Get data from domain external sources |
|
Access store |
|
Subscribe |
|
FEATURE
Subscribe in template |
|
Facade in template |
|
Keep component as small as possible |
|
Use angular life cycle onlnit for initialization |
|
Use Constructor only for dependency injection |
|
Write components style |
|
Add buisness logic |
|
DOMAIN / Shell
Register feature modules |
|
Add business logic |
|
UTILS
Try to avoid |
|
Write pure functions which are used in feature AND domain |
|
UI
Write dum components whitch can be shared between features |
|
|
|
TESTING / UNIT TEST
Mock everything |
|
Make use of mockbuilder |
|
Test streams with testScheduler (marbles) |
|
One expect per it |
|
Use TestBed |
|
Subscribe to observable |
|
If it does communicate, it is not a unit test.
TESTING / INTEGRATION
Mock server calls |
|
Use correct selector |
|
Test acceptance criteria |
|
Test text, color |
|
Test erver calls |
|
TESTING / E2E
Test server calls |
|
Mock |
|
|
Created By
Metadata
Comments
No comments yet. Add yours below!
Add a Comment