This is a mocked version of cht-core's rules-engine's rules-emitter module
https://github.com/medic/cht-core/blob/master/shared-libs/rules-engine/src/rules-emitter.js
This mock provides (nearly?) identical functionally to the production emitter but avoids the bundled result code from cht-conf and avoids nools. The behaviour
of the system may not be identical for all cases, but provides some useful experiences for test authors.
https://github.com/medic/cht-conf-test-harness/pull/103
Methods
(inner) getEmissionsFor(contactDocs, reportDocs, taskDocs) → {Promise.<Object>|Array.<Object>|Array.<Object>}
Runs the partner's rules code for a set of documents and returns all emissions from nools
Parameters:
Name | Type | Description |
---|---|---|
contactDocs |
Array.<Object> | A set of contact documents |
reportDocs |
Array.<Object> | All of the contacts' reports |
taskDocs |
Array.<Object> | All of the contacts' task documents (must be linked by requester to a contact) |
Returns:
-
emissions The raw emissions from nools
- Type
- Promise.<Object>
-
emissions.tasks Array of task emissions
- Type
- Array.<Object>
-
emissions.targets Array of target emissions
- Type
- Array.<Object>
(inner) initialize(settings) → {Boolean}
Initializes the rules emitter
Parameters:
Name | Type | Description | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
settings |
Object | Settings for the behavior of the rules emitter
Properties
|
Returns:
Success
- Type
- Boolean