diff --git a/lib/Adaptor.js b/lib/Adaptor.js index 0bfea6f..bc845fc 100644 --- a/lib/Adaptor.js +++ b/lib/Adaptor.js @@ -144,58 +144,51 @@ function configMigrationHelper(state) { return state; } // NOTE: In order to prevent unintended exposure of authentication information // in the logs, we make use of an axios interceptor. +// axios.interceptors.response.use( +// function (response) { +// const contentType = response.headers['content-type']?.split(';')[0]; +// const acceptHeaders = response.config.headers['Accept'] +// .split(';')[0] +// .split(','); +// if (response.config.method === 'get') { +// if (indexOf(acceptHeaders, contentType) === -1) { +// const newError = { +// status: 404, +// message: 'Unexpected content returned', +// responseData: response.data, +// }; +// Log.error(newError.message); +// return Promise.reject(newError); +// } +// } +// if ( +// typeof response?.data === 'string' && +// contentType === CONTENT_TYPES?.json +// ) { +// try { +// response = { ...response, data: JSON.parse(response.data) }; +// } catch (error) { +// Log.warn('Non-JSON response detected, unable to parse.'); +// } +// } +// return response; +// }, +// function (error) { +// try { +// const details = error.toJSON(); +// if (details?.config?.auth) details.config.auth = '--REDACTED--'; +// if (details?.config?.data) details.config.data = '--REDACTED--'; +// Log.error(details.message); +// return Promise.reject(details); +// } catch (e) { +// // TODO: @Elias, why does this error sometimes already appear to be JSONified? +// // console.log(e) // "not JSONABLE TypeError: error.toJSON is not a function" +// Log.error(error.message); +// return Promise.reject(error); +// } +// } +// ); - -_axios.default.interceptors.response.use(function (response) { - var _response$headers$con, _response; - - const contentType = (_response$headers$con = response.headers['content-type']) === null || _response$headers$con === void 0 ? void 0 : _response$headers$con.split(';')[0]; - const acceptHeaders = response.config.headers['Accept'].split(';')[0].split(','); - - if (response.config.method === 'get') { - if ((0, _lodash.indexOf)(acceptHeaders, contentType) === -1) { - const newError = { - status: 404, - message: 'Unexpected content returned', - responseData: response.data - }; - - _Utils.Log.error(newError.message); - - return Promise.reject(newError); - } - } - - if (typeof ((_response = response) === null || _response === void 0 ? void 0 : _response.data) === 'string' && contentType === (_Utils.CONTENT_TYPES === null || _Utils.CONTENT_TYPES === void 0 ? void 0 : _Utils.CONTENT_TYPES.json)) { - try { - response = { ...response, - data: JSON.parse(response.data) - }; - } catch (error) { - _Utils.Log.warn('Non-JSON response detected, unable to parse.'); - } - } - - return response; -}, function (error) { - try { - var _details$config, _details$config2; - - const details = error.toJSON(); - if (details === null || details === void 0 ? void 0 : (_details$config = details.config) === null || _details$config === void 0 ? void 0 : _details$config.auth) details.config.auth = '--REDACTED--'; - if (details === null || details === void 0 ? void 0 : (_details$config2 = details.config) === null || _details$config2 === void 0 ? void 0 : _details$config2.data) details.config.data = '--REDACTED--'; - - _Utils.Log.error(details.message); - - return Promise.reject(details); - } catch (e) { - // TODO: @Elias, why does this error sometimes already appear to be JSONified? - // console.log(e) // "not JSONABLE TypeError: error.toJSON is not a function" - _Utils.Log.error(error.message); - - return Promise.reject(error); - } -}); /** * Create a record * @public @@ -321,6 +314,8 @@ function create(resourceType, data, options, callback) { _Utils.Log.success(`Created ${resourceType}: ${result.headers.location}`); return (0, _Utils.handleResponse)(result, state, callback); + }).catch(error => { + console.log('ERROR', error); }); }; } diff --git a/lib/Utils.js b/lib/Utils.js index 7eb089c..c9f0d0f 100644 --- a/lib/Utils.js +++ b/lib/Utils.js @@ -42,7 +42,8 @@ exports.Log = Log; function buildUrl(path, hostUrl, apiVersion) { const pathSuffix = apiVersion ? `/${apiVersion}${path}` : `${path}`; return hostUrl + '/api' + pathSuffix; -} +} // Write a unit test for this one + function handleResponse(result, state, callback) { const { @@ -71,8 +72,7 @@ function generateUrl(configuration, options, resourceType) { } = configuration; const urlString = '/' + resourceType; // Note that users can override the apiVersion from configuration with args - if (options === null || options === void 0 ? void 0 : options.apiVersion) apiVersion = options.apiVersion; // TODO: discuss how this actually works on DHIS2. I'm not sure I'm following. - + if (options === null || options === void 0 ? void 0 : options.apiVersion) apiVersion = options.apiVersion; const apiMessage = apiVersion ? `Using DHIS2 api version ${apiVersion}` : 'Using latest available version of the DHIS2 api on this server.'; console.log(apiMessage); return buildUrl(urlString, hostUrl, apiVersion); diff --git a/src/Utils.js b/src/Utils.js index 3d42016..fd97c81 100644 --- a/src/Utils.js +++ b/src/Utils.js @@ -27,6 +27,7 @@ export function buildUrl(path, hostUrl, apiVersion) { return hostUrl + '/api' + pathSuffix; } +// Write a unit test for this one export function handleResponse(result, state, callback) { const { data } = result; if (callback) return callback(composeNextState(state, data)); @@ -50,7 +51,6 @@ export function generateUrl(configuration, options, resourceType) { // Note that users can override the apiVersion from configuration with args if (options?.apiVersion) apiVersion = options.apiVersion; - // TODO: discuss how this actually works on DHIS2. I'm not sure I'm following. const apiMessage = apiVersion ? `Using DHIS2 api version ${apiVersion}` : 'Using latest available version of the DHIS2 api on this server.'; diff --git a/test/integration.js b/test/integration.js index 9ff4e48..03493b7 100644 --- a/test/integration.js +++ b/test/integration.js @@ -3,13 +3,19 @@ const { create, execute, get, update } = require('../src/Adaptor'); const crypto = require('crypto'); const { upsert } = require('../lib/Adaptor'); -const getRandomOrganisationUnitPayload = user => { - const name = crypto.randomBytes(16).toString('hex'); - const shortName = name.substring(0, 5); - const displayName = name; - const openingDate = new Date().toISOString(); - return { name, shortName, displayName, openingDate, users: [user] }; -}; +// const getRandomOrganisationUnitPayload = user => { +// const name = crypto.randomBytes(16).toString('hex'); +// const shortName = name.substring(0, 5); +// const displayName = name; +// const openingDate = new Date().toISOString(); +// return { name, shortName, displayName, openingDate, users: [user] }; +// }; + +// const getRandomProgramStagePayload = program => { +// const name = crypto.randomBytes(16).toString('hex'); +// const displayName = name; +// return { name, displayName, program }; +// }; const getRandomProgramPayload = () => { const name = crypto.randomBytes(16).toString('hex'); @@ -18,468 +24,391 @@ const getRandomProgramPayload = () => { return { name, shortName, programType }; }; -const getRandomProgramStagePayload = program => { - const name = crypto.randomBytes(16).toString('hex'); - const displayName = name; - return { name, displayName, program }; -}; - -const globalState = { - configuration: { - username: 'admin', - password: 'district', - hostUrl: 'https://play.dhis2.org/2.36.4', - }, - program: 'IpHINAT79UW', - organisationUnit: 'DiszpKrYNg8', - dataSet: 'pBOMPrpg1QX', - trackedEntityInstance: 'bmshzEacgxa', - programStage: 'A03MvHHogjR', - dataElement: 'Ix2HsbDMLea', - enrollment: 'CmsHzercTBa', -}; - -describe('create', () => { - it('should create an event program', async () => { - const state = { - ...globalState, - data: { program: getRandomProgramPayload() }, - }; +describe('Integration tests', () => { + const fixture = {}; - const response = await execute( - create('programs', state => state.data.program) - )(state); - expect({ - httpStatus: response.data.httpStatus, - httpStatusCode: response.data.httpStatusCode, - status: response.data.status, - }).to.eql({ - httpStatus: 'Created', - httpStatusCode: 201, - status: 'OK', - }); - }); - - it('should create a single event', async () => { - const state = { - ...globalState, - data: { - program: 'eBAyeGv0exc', - orgUnit: 'DiszpKrYNg8', - status: 'COMPLETED', + before(done => { + fixture.initialState = { + configuration: { + username: 'admin', + password: 'district', + hostUrl: 'https://play.dhis2.org/2.36.6', }, }; - const response = await execute(create('events', state => state.data))( - state - ); - globalState.event = response.data.response.uid; - expect({ - httpStatus: response.data.httpStatus, - httpStatusCode: response.data.httpStatusCode, - status: response.data.status, - }).to.eql({ - httpStatus: 'OK', - httpStatusCode: 200, - status: 'OK', - }); + done(); }); - it('should create a single tracked entity instance', async () => { - const state = { - ...globalState, - data: { - orgUnit: globalState.organisationUnit, - trackedEntityType: 'nEenWmSyUEp', - attributes: [ - { - attribute: 'w75KJ2mc4zz', - value: 'Gigiwe', - }, - ], - }, - }; - const response = await execute( - create('trackedEntityInstances', state => state.data) - )(state); - globalState.trackedEntityInstance = - response.data.response.importSummaries[0].reference; - expect({ - httpStatus: response.data.httpStatus, - httpStatusCode: response.data.httpStatusCode, - status: response.data.status, - }).to.eql({ - httpStatus: 'OK', - httpStatusCode: 200, - status: 'OK', + describe('create', () => { + it('should create an event program', async () => { + const state = { + ...fixture.initialState, + data: { program: getRandomProgramPayload() }, + }; + + const finalState = await execute( + create('programs', state => state.data.program) + )(state); + + expect(finalState.data.status).to.eq('OK'); }); - }); - it('should create a single dataValueSet', async () => { - const state = { - ...globalState, - data: { - dataElement: 'f7n9E0hX8qk', - period: '201401', - orgUnit: globalState.organisationUnit, - value: '12', - }, - }; + it('should create a single event', async () => { + const state = { + ...fixture.initialState, + data: { + program: 'eBAyeGv0exc', + orgUnit: 'DiszpKrYNg8', + status: 'COMPLETED', + }, + }; - const response = await execute( - create('dataValueSets', state => state.data) - )(state); - expect({ status: response.data.status }).to.eql({ status: 'SUCCESS' }); - }); + const finalState = await execute(create('events', state => state.data))( + state + ); - it('should create a set of related data values sharing the same period and organisation unit', async () => { - const state = { - ...globalState, - data: { - dataSet: globalState.dataSet, - completeDate: '2014-02-03', - period: '201401', - orgUnit: globalState.organisationUnit, - dataValues: [ - { - dataElement: 'f7n9E0hX8qk', - value: '1', - }, - { - dataElement: 'Ix2HsbDMLea', - value: '2', - }, - { - dataElement: 'eY5ehpbEsB7', - value: '3', - }, - ], - }, - }; + console.log('FINAL STATE', finalState); - const response = await execute( - create('dataValueSets', state => state.data) - )(state); - expect({ status: response.data.status }).to.eql({ status: 'SUCCESS' }); - }); + expect(finalState.data.status).to.eq('OK'); + }); - // it('should create a single enrollment of a trackedEntityInstance into a given program', async () => { - // const state = { - // ...globalState, - // data: { - // trackedEntityInstance: globalState.trackedEntityInstance, - // orgUnit: globalState.organisationUnit, - // program: globalState.program, - // enrollmentDate: new Date().toISOString().split('T')[0], - // incidentDate: new Date().toISOString().split('T')[0], - // }, - // }; - - // const response = await execute(create('enrollments', state => state.data))( - // state - // ); - // expect({ status: response.data.status }).to.eql({ status: 'SUCCESS' }); - // }); -}); + it('should create a single tracked entity instance', async () => { + const state = { + ...fixture.initialState, + data: { + orgUnit: 'DiszpKrYNg8', + trackedEntityType: 'nEenWmSyUEp', + attributes: [ + { + attribute: 'w75KJ2mc4zz', + value: 'Gigiwe', + }, + ], + }, + }; -describe('update', () => { - it('should update an event program', async () => { - const state = { - ...globalState, - data: { program: getRandomProgramPayload() }, - }; + const finalState = await execute( + create('trackedEntityInstances', state => state.data) + )(state); - const response = await execute( - update( - 'programs', - state => state.program, - state => state.data.program - ) - )(state); - expect({ - httpStatus: response.data.httpStatus, - httpStatusCode: response.data.httpStatusCode, - status: response.data.status, - }).to.eql({ - httpStatus: 'OK', - httpStatusCode: 200, - status: 'OK', + expect(finalState.data.status).to.eq('OK'); }); - }); - it('should update a single event', async () => { - const state = { - ...globalState, - event: 'OZ3mVgaIAqw', - data: { - program: 'eBAyeGv0exc', - orgUnit: 'DiszpKrYNg8', - status: 'COMPLETED', - }, - }; - const response = await execute( - update( - 'events', - state => state.event, - state => state.data - ) - )(state); - expect({ - httpStatus: response.data.httpStatus, - httpStatusCode: response.data.httpStatusCode, - status: response.data.status, - }).to.eql({ - httpStatus: 'OK', - httpStatusCode: 200, - status: 'OK', - }); - }); + it('should create a single dataValueSet', async () => { + const state = { + ...fixture.initialState, + data: { + dataElement: 'f7n9E0hX8qk', + period: '201401', + orgUnit: 'DiszpKrYNg8', + value: '12', + }, + }; - it('should update a single tracked entity instance', async () => { - const state = { - ...globalState, - data: { - orgUnit: globalState.organisationUnit, - trackedEntityType: 'nEenWmSyUEp', - attributes: [ - { - attribute: 'w75KJ2mc4zz', - value: 'Gigiwe', - }, - ], - }, - }; + const finalState = await execute( + create('dataValueSets', state => state.data) + )(state); - const response = await execute( - update( - 'trackedEntityInstances', - state => state.trackedEntityInstance, - state => state.data - ) - )(state); - - expect({ - httpStatus: response.data.httpStatus, - httpStatusCode: response.data.httpStatusCode, - status: response.data.status, - }).to.eql({ - httpStatus: 'OK', - httpStatusCode: 200, - status: 'OK', + expect(finalState.data.status).to.eq('SUCCESS'); }); - }); - it('should update a single dataValueSet', async () => { - const state = { - ...globalState, - data: { - dataElement: 'f7n9E0hX8qk', - period: '201401', - orgUnit: globalState.organisationUnit, - value: '12', - }, - }; - const response = await execute( - update( - 'dataValueSets', - state => state.dataSet, - state => state.data - ) - )(state); - expect({ status: response.data.status }).to.eql({ status: 'SUCCESS' }); - }); + it('should create a set of related data values sharing the same period and organisation unit', async () => { + const state = { + ...fixture.initialState, + data: { + dataSet: 'pBOMPrpg1QX', + completeDate: '2014-02-03', + period: '201401', + orgUnit: 'DiszpKrYNg8', + dataValues: [ + { + dataElement: 'f7n9E0hX8qk', + value: '1', + }, + { + dataElement: 'Ix2HsbDMLea', + value: '2', + }, + { + dataElement: 'eY5ehpbEsB7', + value: '3', + }, + ], + }, + }; - it('should update a set of related data values sharing the same period and organisation unit', async () => { - const state = { - ...globalState, - data: { - dataSet: globalState.dataSet, - completeDate: '2014-02-03', - period: '201401', - orgUnit: globalState.organisationUnit, - dataValues: [ - { - dataElement: 'f7n9E0hX8qk', - value: '1', - }, - { - dataElement: 'Ix2HsbDMLea', - value: '2', - }, - { - dataElement: 'eY5ehpbEsB7', - value: '3', - }, - ], - }, - }; + const finalState = await execute( + create('dataValueSets', state => state.data) + )(state); - const response = await execute( - update( - 'dataValueSets', - state => state.dataSet, - state => state.data - ) - )(state); - expect({ status: response.data.status }).to.eql({ status: 'SUCCESS' }); + expect(finalState.data.status).to.eq('SUCCESS'); + }); }); -}); -describe('get', () => { - const state = { - configuration: { - username: 'admin', - password: 'district', - hostUrl: 'https://play.dhis2.org/2.36.4', - }, - data: {}, - }; - - it('should get trackedEntityInstances matching the URL parameters specified', async () => { - const response = await execute( - get('trackedEntityInstances', { - params: { - fields: '*', - ou: 'DiszpKrYNg8', - entityType: 'nEenWmSyUEp', - trackedEntityInstance: 'dNpxRu1mWG5', - }, - }) - )(state); - expect(response.data.trackedEntityInstances.length).to.gte(1); - }); + describe('update', () => { + it('should update an event program', async () => { + const state = { + ...fixture.initialState, + program: 'eBAyeGv0exc', + data: { program: getRandomProgramPayload() }, + }; - it('should get all programs in the organisation unit TSyzvBiovKh', async () => { - const response = await execute( - get('programs', { - params: { orgUnit: 'TSyzvBiovKh', fields: '*' }, - }) - )(state); - expect(response.data.programs.length).to.gte(1); - }); -}); + const response = await execute( + update( + 'programs', + state => state.program, + state => state.data.program + ) + )(state); + expect(response.data.status).to.eq('OK'); + }); + + it('should update a single event', async () => { + const state = { + ...fixture.initialState, + event: 'OZ3mVgaIAqw', + data: { + program: 'eBAyeGv0exc', + orgUnit: 'DiszpKrYNg8', + status: 'COMPLETED', + }, + }; + const finalState = await execute( + update( + 'events', + state => state.event, + state => state.data + ) + )(state); + expect(finalState.data.status).to.eql('OK'); + }); -describe('upsert', () => { - const state = { - configuration: { - username: 'admin', - password: 'district', - hostUrl: 'https://play.dhis2.org/2.36.4', - }, - data: {}, - }; - - it('should upsert a trackedEntityInstance matching the URL parameters', async () => { - const response = await execute( - upsert( - 'trackedEntityInstances', - { - created: '2019-08-21T13:27:51.119', + it('should update a single tracked entity instance', async () => { + const state = { + ...fixture.initialState, + data: { orgUnit: 'DiszpKrYNg8', - createdAtClient: '2019-03-19T01:11:03.924', - trackedEntityInstance: 'dNpxRu1mWG5', - lastUpdated: '2019-09-27T00:02:11.604', - trackedEntityType: 'We9I19a3vO1', - lastUpdatedAtClient: '2019-03-19T01:11:03.924', - coordinates: - '[[[-11.8049,8.3374],[-11.8032,8.3436],[-11.8076,8.3441],[-11.8096,8.3387],[-11.8049,8.3374]]]', - inactive: false, - deleted: false, - featureType: 'POLYGON', - geometry: { - type: 'Polygon', - coordinates: [ - [ - [-11.8049, 8.3374], - [-11.8032, 8.3436], - [-11.8076, 8.3441], - [-11.8096, 8.3387], - [-11.8049, 8.3374], - ], - ], - }, - programOwners: [ + trackedEntityType: 'nEenWmSyUEp', + attributes: [ { - ownerOrgUnit: 'DiszpKrYNg8', - program: 'M3xtLkYBlKI', - trackedEntityInstance: 'dNpxRu1mWG5', + attribute: 'w75KJ2mc4zz', + value: 'Gigiwe', }, ], - enrollments: [], - relationships: [ + }, + }; + + const finalState = await execute( + update('trackedEntityInstances', 'bmshzEacgxa', state => state.data) + )(state); + + expect(finalState.data.status).to.eq('OK'); + }); + + it('should update a single dataValueSet', async () => { + const state = { + ...fixture.initialState, + data: { + dataElement: 'f7n9E0hX8qk', + period: '201401', + orgUnit: 'DiszpKrYNg8', + value: '12', + }, + }; + const finalState = await execute( + update('dataValueSets', 'pBOMPrpg1QX', state => state.data) + )(state); + expect(finalState.data.status).to.eql('SUCCESS'); + }); + + it('should update a set of related data values sharing the same period and organisation unit', async () => { + const state = { + ...fixture.initialState, + data: { + dataSet: 'pBOMPrpg1QX', + completeDate: '2014-02-03', + period: '201401', + orgUnit: 'DiszpKrYNg8', + dataValues: [ { - lastUpdated: '2019-08-21T00:00:00.000', - created: '2019-08-21T00:00:00.000', - relationshipName: 'Focus to Case', - bidirectional: false, - relationshipType: 'Mv8R4MPcNcX', - relationship: 'EDfZpCLcEVN', - from: { - trackedEntityInstance: { - trackedEntityInstance: 'dNpxRu1mWG5', - programOwners: [], - }, - }, - to: { - trackedEntityInstance: { - trackedEntityInstance: 'Fbru4rg4dYV', - programOwners: [], - }, - }, + dataElement: 'f7n9E0hX8qk', + value: '1', }, { - lastUpdated: '2019-08-21T00:00:00.000', - created: '2019-08-21T00:00:00.000', - relationshipName: 'Focus to Case', - bidirectional: false, - relationshipType: 'Mv8R4MPcNcX', - relationship: 'z4ItJx8ul3Z', - from: { - trackedEntityInstance: { - trackedEntityInstance: 'dNpxRu1mWG5', - programOwners: [], - }, - }, - to: { - trackedEntityInstance: { - trackedEntityInstance: 'RHA9RWNvAnC', - programOwners: [], - }, - }, + dataElement: 'Ix2HsbDMLea', + value: '2', }, { - lastUpdated: '2019-08-21T00:00:00.000', - created: '2019-08-21T00:00:00.000', - relationshipName: 'Focus to Case', - bidirectional: false, - relationshipType: 'Mv8R4MPcNcX', - relationship: 'XIfv95ZiM4H', - from: { - trackedEntityInstance: { - trackedEntityInstance: 'dNpxRu1mWG5', - programOwners: [], - }, - }, - to: { - trackedEntityInstance: { - trackedEntityInstance: 'jZRaFaYkAtE', - programOwners: [], - }, - }, + dataElement: 'eY5ehpbEsB7', + value: '3', }, ], - attributes: [], }, - { - params: { - fields: '*', - ou: 'DiszpKrYNg8', - entityType: 'nEenWmSyUEp', - trackedEntityInstance: 'dNpxRu1mWG5', - }, - } - ) - )(state); - expect(response.data.httpStatusCode).to.eq(200); - expect(response.data.httpStatus).to.eq('OK'); + }; + + const finalState = await execute( + update('dataValueSets', 'pBOMPrpg1QX', state => state.data) + )(state); + expect(finalState.data.status).to.eq('SUCCESS'); + }); }); }); + +// describe('get', () => { +// const state = { +// configuration: { +// username: 'admin', +// password: 'district', +// hostUrl: 'https://play.dhis2.org/2.36.4', +// }, +// data: {}, +// }; + +// it('should get trackedEntityInstances matching the URL parameters specified', async () => { +// const response = await execute( +// get('trackedEntityInstances', { +// params: { +// fields: '*', +// ou: 'DiszpKrYNg8', +// entityType: 'nEenWmSyUEp', +// trackedEntityInstance: 'dNpxRu1mWG5', +// }, +// }) +// )(state); +// expect(response.data.trackedEntityInstances.length).to.gte(1); +// }); + +// it('should get all programs in the organisation unit TSyzvBiovKh', async () => { +// const response = await execute( +// get('programs', { +// params: { orgUnit: 'TSyzvBiovKh', fields: '*' }, +// }) +// )(state); +// expect(response.data.programs.length).to.gte(1); +// }); +// }); + +// describe('upsert', () => { +// const state = { +// configuration: { +// username: 'admin', +// password: 'district', +// hostUrl: 'https://play.dhis2.org/2.36.4', +// }, +// data: {}, +// }; + +// it('should upsert a trackedEntityInstance matching the URL parameters', async () => { +// const response = await execute( +// upsert( +// 'trackedEntityInstances', +// { +// created: '2019-08-21T13:27:51.119', +// orgUnit: 'DiszpKrYNg8', +// createdAtClient: '2019-03-19T01:11:03.924', +// trackedEntityInstance: 'dNpxRu1mWG5', +// lastUpdated: '2019-09-27T00:02:11.604', +// trackedEntityType: 'We9I19a3vO1', +// lastUpdatedAtClient: '2019-03-19T01:11:03.924', +// coordinates: +// '[[[-11.8049,8.3374],[-11.8032,8.3436],[-11.8076,8.3441],[-11.8096,8.3387],[-11.8049,8.3374]]]', +// inactive: false, +// deleted: false, +// featureType: 'POLYGON', +// geometry: { +// type: 'Polygon', +// coordinates: [ +// [ +// [-11.8049, 8.3374], +// [-11.8032, 8.3436], +// [-11.8076, 8.3441], +// [-11.8096, 8.3387], +// [-11.8049, 8.3374], +// ], +// ], +// }, +// programOwners: [ +// { +// ownerOrgUnit: 'DiszpKrYNg8', +// program: 'M3xtLkYBlKI', +// trackedEntityInstance: 'dNpxRu1mWG5', +// }, +// ], +// enrollments: [], +// relationships: [ +// { +// lastUpdated: '2019-08-21T00:00:00.000', +// created: '2019-08-21T00:00:00.000', +// relationshipName: 'Focus to Case', +// bidirectional: false, +// relationshipType: 'Mv8R4MPcNcX', +// relationship: 'EDfZpCLcEVN', +// from: { +// trackedEntityInstance: { +// trackedEntityInstance: 'dNpxRu1mWG5', +// programOwners: [], +// }, +// }, +// to: { +// trackedEntityInstance: { +// trackedEntityInstance: 'Fbru4rg4dYV', +// programOwners: [], +// }, +// }, +// }, +// { +// lastUpdated: '2019-08-21T00:00:00.000', +// created: '2019-08-21T00:00:00.000', +// relationshipName: 'Focus to Case', +// bidirectional: false, +// relationshipType: 'Mv8R4MPcNcX', +// relationship: 'z4ItJx8ul3Z', +// from: { +// trackedEntityInstance: { +// trackedEntityInstance: 'dNpxRu1mWG5', +// programOwners: [], +// }, +// }, +// to: { +// trackedEntityInstance: { +// trackedEntityInstance: 'RHA9RWNvAnC', +// programOwners: [], +// }, +// }, +// }, +// { +// lastUpdated: '2019-08-21T00:00:00.000', +// created: '2019-08-21T00:00:00.000', +// relationshipName: 'Focus to Case', +// bidirectional: false, +// relationshipType: 'Mv8R4MPcNcX', +// relationship: 'XIfv95ZiM4H', +// from: { +// trackedEntityInstance: { +// trackedEntityInstance: 'dNpxRu1mWG5', +// programOwners: [], +// }, +// }, +// to: { +// trackedEntityInstance: { +// trackedEntityInstance: 'jZRaFaYkAtE', +// programOwners: [], +// }, +// }, +// }, +// ], +// attributes: [], +// }, +// { +// params: { +// fields: '*', +// ou: 'DiszpKrYNg8', +// entityType: 'nEenWmSyUEp', +// trackedEntityInstance: 'dNpxRu1mWG5', +// }, +// } +// ) +// )(state); +// expect(response.data.httpStatusCode).to.eq(200); +// expect(response.data.httpStatus).to.eq('OK'); +// }); +// });