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

Commit

Permalink
Merge pull request #47 from OpenFn/new_pattern_for_helpers
Browse files Browse the repository at this point in the history
New pattern for helpers
  • Loading branch information
taylordowns2000 committed Dec 22, 2021
2 parents af61680 + 0a2f26f commit 6b6aaea
Show file tree
Hide file tree
Showing 16 changed files with 2,085 additions and 6,841 deletions.
11 changes: 10 additions & 1 deletion .babelrc
Expand Up @@ -6,5 +6,14 @@
"@babel/plugin-proposal-private-methods",
"@babel/plugin-proposal-nullish-coalescing-operator"
],
"presets": ["@babel/preset-env"]
"presets": [
[
"@babel/preset-env",
{
"targets": {
"node": "10"
}
}
]
]
}
2 changes: 1 addition & 1 deletion .devcontainer/devcontainer.json
Expand Up @@ -9,7 +9,7 @@
},

"containerEnv": {
"GH_TOKEN": "${localEnv:GH_TOKEN}",
"GH_TOKEN": "${localEnv:GH_TOKEN}"
},

"mounts": [
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -3,5 +3,5 @@ node_js:
# NOTE: to test current stable, uncomment "node"
# - node # Current stable, i.e. 13 in October, 2019
# - lts/* # Most recent LTS version, i.e. 12 in October, 2019
- 12 # Explicitly include an active LTS version
- 14 # Explicitly include an active LTS version
# - 10 # Explicitly include an active LTS version
43 changes: 39 additions & 4 deletions README.md
@@ -1,7 +1,7 @@
# Language DHIS2 [![Build Status](https://travis-ci.org/OpenFn/language-dhis2.svg?branch=main)](https://travis-ci.org/OpenFn/language-dhis2)

Language Pack for building expressions and operations for working with
the [DHIS2 API](http://dhis2.github.io/dhis2-docs/master/en/developer/html/dhis2_developer_manual.html).
Language Pack for building expressions and operations for working with the
[DHIS2 API](http://dhis2.github.io/dhis2-docs/master/en/developer/html/dhis2_developer_manual.html).

## Documentation

Expand Down Expand Up @@ -38,7 +38,7 @@ fetchAnalytics({
outputIdScheme: 'UID',
},
});
````
```

## Tracked Entity API

Expand Down Expand Up @@ -174,4 +174,39 @@ Clone the repo, run `npm install`.

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

Build the project using `make`.
NB: There are two types of tests: unit tests and integration tests.

### Unit Tests

Unit tests allows to test the functionalities of the adaptor helper functions
such as:

> Does `create('events', payload)` perform a post request to the correct DHIS2
> API?
To run unit tests execute `npm run test` (they're the default tests).

Anytime a new functionality is added to the helper functions, more unit tests
needs to be added.

### End-to-end integration tests

Integration tests allow us to test the end-to-end behavior of the helper functions
and also to test the examples we provide via inline documentation.

For example with integration tests we answer the following question:

> Does `create('events', eventPayload)` actually create a new event in a live
> DHIS2 system?
To run integration tests, execute `npm run integration-test`. These
tests use network I/O and a public connection to a DHIS2 "play" server so their
timing and performance is unpredictable. Consider adding an increased timeout,
and modifying the orgUnit, program, etc., IDs set in `globalState`.

Anytime a new example is added in the documentation of a helper function, a new
integration test should be done.

### Build

Build the project using `npm run build`.

0 comments on commit 6b6aaea

Please sign in to comment.