Skip to content
This repository was archived by the owner on Oct 21, 2022. It is now read-only.

Commit 6b6aaea

Browse files
Merge pull request #47 from OpenFn/new_pattern_for_helpers
New pattern for helpers
2 parents af61680 + 0a2f26f commit 6b6aaea

File tree

16 files changed

+2085
-6841
lines changed

16 files changed

+2085
-6841
lines changed

.babelrc

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,14 @@
66
"@babel/plugin-proposal-private-methods",
77
"@babel/plugin-proposal-nullish-coalescing-operator"
88
],
9-
"presets": ["@babel/preset-env"]
9+
"presets": [
10+
[
11+
"@babel/preset-env",
12+
{
13+
"targets": {
14+
"node": "10"
15+
}
16+
}
17+
]
18+
]
1019
}

.devcontainer/devcontainer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
},
1010

1111
"containerEnv": {
12-
"GH_TOKEN": "${localEnv:GH_TOKEN}",
12+
"GH_TOKEN": "${localEnv:GH_TOKEN}"
1313
},
1414

1515
"mounts": [

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ node_js:
33
# NOTE: to test current stable, uncomment "node"
44
# - node # Current stable, i.e. 13 in October, 2019
55
# - lts/* # Most recent LTS version, i.e. 12 in October, 2019
6-
- 12 # Explicitly include an active LTS version
6+
- 14 # Explicitly include an active LTS version
77
# - 10 # Explicitly include an active LTS version

README.md

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Language DHIS2 [![Build Status](https://travis-ci.org/OpenFn/language-dhis2.svg?branch=main)](https://travis-ci.org/OpenFn/language-dhis2)
22

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).
55

66
## Documentation
77

@@ -38,7 +38,7 @@ fetchAnalytics({
3838
outputIdScheme: 'UID',
3939
},
4040
});
41-
````
41+
```
4242

4343
## Tracked Entity API
4444

@@ -174,4 +174,39 @@ Clone the repo, run `npm install`.
174174

175175
Run tests using `npm run test` or `npm run test:watch`
176176

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

Comments
 (0)