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

Commit

Permalink
added more integration tests for get, helps with #48"
Browse files Browse the repository at this point in the history
  • Loading branch information
taylordowns2000 committed Dec 23, 2021
1 parent 773e012 commit beac452
Showing 1 changed file with 36 additions and 1 deletion.
37 changes: 36 additions & 1 deletion test/integration.js
Expand Up @@ -148,7 +148,7 @@ describe('Integration tests', () => {
expect(response.data.status).to.eq('OK');
});

it.only('should update a single event', async () => {
it('should update a single event', async () => {
const state = {
...fixture.initialState,
event: 'rBjxtO8npTb',
Expand Down Expand Up @@ -265,6 +265,41 @@ describe('Integration tests', () => {
expect(finalState.data.dataValues.length).to.gte(1);
});

it('should get a single TEI based on multiple filters', async () => {
const finalState = await execute(
get('trackedEntityInstances', {
ou: 'DiszpKrYNg8',
filter: ['w75KJ2mc4zz:Eq:John', 'zDhUuAYrxNC:Eq:Doe'],
})
)(state);

expect(finalState.data.trackedEntityInstances.length).to.eq(1);

const finalState2 = await execute(
get('trackedEntityInstances', {
ou: 'DiszpKrYNg8',
filter: ['w75KJ2mc4zz:Eq:John', 'zDhUuAYrxNC:Eq:NotDoe'],
})
)(state);

expect(finalState2.data.trackedEntityInstances.length).to.eq(0);
});

it('should get a no TEIs if non match the filters', async () => {
const finalState = await execute(
get('trackedEntityInstances', {
ou: 'DiszpKrYNg8',
filter: [
'w75KJ2mc4zz:Eq:John',
'flGbXLXCrEo:Eq:124-not-a-real-id', // case ID
'zDhUuAYrxNC:Eq:Doe',
],
})
)(state);

expect(finalState.data.trackedEntityInstances.length).to.eq(0);
});

it('should get all programs in the organisation unit TSyzvBiovKh', async () => {
const response = await execute(
get('programs', { orgUnit: 'TSyzvBiovKh', fields: '*' })
Expand Down

0 comments on commit beac452

Please sign in to comment.