|
1 | 1 | # Language DHIS2 [](https://travis-ci.org/OpenFn/language-dhis2) |
2 | 2 |
|
3 | | -Language Pack for building expressions and operations for working with |
4 | | -the [DHIS2 API](http://dhis2.github.io/dhis2-docs/master/en/developer/html/dhis2_developer_manual.html). |
| 3 | +Language Pack for building expressions and operations for working with the |
| 4 | +[DHIS2 API](http://dhis2.github.io/dhis2-docs/master/en/developer/html/dhis2_developer_manual.html). |
5 | 5 |
|
6 | 6 | ## Documentation |
7 | 7 |
|
@@ -38,7 +38,7 @@ fetchAnalytics({ |
38 | 38 | outputIdScheme: 'UID', |
39 | 39 | }, |
40 | 40 | }); |
41 | | -```` |
| 41 | +``` |
42 | 42 |
|
43 | 43 | ## Tracked Entity API |
44 | 44 |
|
@@ -174,4 +174,39 @@ Clone the repo, run `npm install`. |
174 | 174 |
|
175 | 175 | Run tests using `npm run test` or `npm run test:watch` |
176 | 176 |
|
177 | | -Build the project using `make`. |
| 177 | +NB: There are two types of tests: unit tests and integration tests. |
| 178 | + |
| 179 | +### Unit Tests |
| 180 | + |
| 181 | +Unit tests allows to test the functionalities of the adaptor helper functions |
| 182 | +such as: |
| 183 | + |
| 184 | +> Does `create('events', payload)` perform a post request to the correct DHIS2 |
| 185 | +> API? |
| 186 | +
|
| 187 | +To run unit tests execute `npm run test` (they're the default tests). |
| 188 | + |
| 189 | +Anytime a new functionality is added to the helper functions, more unit tests |
| 190 | +needs to be added. |
| 191 | + |
| 192 | +### End-to-end integration tests |
| 193 | + |
| 194 | +Integration tests allow us to test the end-to-end behavior of the helper functions |
| 195 | +and also to test the examples we provide via inline documentation. |
| 196 | + |
| 197 | +For example with integration tests we answer the following question: |
| 198 | + |
| 199 | +> Does `create('events', eventPayload)` actually create a new event in a live |
| 200 | +> DHIS2 system? |
| 201 | +
|
| 202 | +To run integration tests, execute `npm run integration-test`. These |
| 203 | +tests use network I/O and a public connection to a DHIS2 "play" server so their |
| 204 | +timing and performance is unpredictable. Consider adding an increased timeout, |
| 205 | +and modifying the orgUnit, program, etc., IDs set in `globalState`. |
| 206 | + |
| 207 | +Anytime a new example is added in the documentation of a helper function, a new |
| 208 | +integration test should be done. |
| 209 | + |
| 210 | +### Build |
| 211 | + |
| 212 | +Build the project using `npm run build`. |
0 commit comments