Skip to content

Commit

Permalink
Fix regressionsin other package tests
Browse files Browse the repository at this point in the history
  • Loading branch information
peterMuriuki committed Sep 1, 2023
1 parent 07e746b commit 9ce0be5
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 57 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,20 +94,13 @@ test('renders correctly in list view', async () => {

nock(props.fhirBaseURL)
.get(`/${patientResourceType}/_search`)
.query({
_getpagesoffset: 0,
_count: 20,
})
.query({ _total: 'accurate', _getpagesoffset: 0, _count: 20 })
.reply(200, patients)
.persist();

nock(props.fhirBaseURL)
.get(`/${patientResourceType}/_search`)
.query({
_getpagesoffset: 0,
_count: 20,
'name:contains': '345',
})
.query({ _total: 'accurate', _getpagesoffset: 0, _count: 20, 'name:contains': '345' })
.reply(200, patients);

render(
Expand Down Expand Up @@ -158,17 +151,14 @@ test('renders correctly in list view', async () => {
// mock requests due to sort
nock(props.fhirBaseURL)
.get(`/${patientResourceType}/_search`)
.query({
_getpagesoffset: 0,
_count: 20,
_sort: 'birthdate',
})
.query({ _total: 'accurate', _getpagesoffset: 0, _count: 20, _sort: 'birthdate' })
.reply(200, sortedAscPatients)
.persist();

nock(props.fhirBaseURL)
.get(`/${patientResourceType}/_search`)
.query({
_total: 'accurate',
_getpagesoffset: 0,
_count: 20,
_sort: 'birthdate',
Expand Down Expand Up @@ -201,17 +191,14 @@ test('renders correctly in list view', async () => {

nock(props.fhirBaseURL)
.get(`/${patientResourceType}/_search`)
.query({
_getpagesoffset: 0,
_count: 20,
_sort: '-birthdate',
})
.query({ _total: 'accurate', _getpagesoffset: 0, _count: 20, _sort: '-birthdate' })
.reply(200, sortedDescPatients)
.persist();

nock(props.fhirBaseURL)
.get(`/${patientResourceType}/_search`)
.query({
_total: 'accurate',
_getpagesoffset: 0,
_count: 20,
_sort: '-birthdate',
Expand Down Expand Up @@ -245,10 +232,7 @@ test('responds as expected to errors', async () => {

nock(props.fhirBaseURL)
.get(`/${patientResourceType}/_search`)
.query({
_getpagesoffset: 0,
_count: 20,
})
.query({ _total: 'accurate', _getpagesoffset: 0, _count: 20 })
.replyWithError('An error happened');

render(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,28 +101,18 @@ test('renders correctly when listing resources', async () => {

nock(props.fhirBaseURL)
.get(`/${healthCareServiceResourceType}/_search`)
.query({
_getpagesoffset: 0,
_count: 20,
})
.query({ _total: 'accurate', _getpagesoffset: 0, _count: 20 })
.reply(200, healthCareServicePage1)
.persist();

nock(props.fhirBaseURL)
.get(`/${healthCareServiceResourceType}/_search`)
.query({
_getpagesoffset: 20,
_count: 20,
})
.query({ _total: 'accurate', _getpagesoffset: 20, _count: 20 })
.reply(200, healthCareServicePage2);

nock(props.fhirBaseURL)
.get(`/${healthCareServiceResourceType}/_search`)
.query({
_getpagesoffset: 0,
_count: 20,
'name:contains': 'testing',
})
.query({ _total: 'accurate', _getpagesoffset: 0, _count: 20, 'name:contains': 'testing' })
.reply(200, healthCareServiceSearch);

render(
Expand Down Expand Up @@ -211,10 +201,7 @@ test('responds as expected to errors', async () => {

nock(props.fhirBaseURL)
.get(`/${healthCareServiceResourceType}/_search`)
.query({
_getpagesoffset: 0,
_count: 20,
})
.query({ _total: 'accurate', _getpagesoffset: 0, _count: 20 })
.replyWithError('coughid');

render(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,28 +108,18 @@ test('renders correctly when listing organizations', async () => {

nock(props.fhirBaseURL)
.get(`/${organizationResourceType}/_search`)
.query({
_getpagesoffset: 0,
_count: 20,
})
.query({ _total: 'accurate', _getpagesoffset: 0, _count: 20 })
.reply(200, organizationsPage1)
.persist();

nock(props.fhirBaseURL)
.get(`/${organizationResourceType}/_search`)
.query({
_getpagesoffset: 20,
_count: 20,
})
.query({ _total: 'accurate', _getpagesoffset: 20, _count: 20 })
.reply(200, organizationsPage2);

nock(props.fhirBaseURL)
.get(`/${organizationResourceType}/_search`)
.query({
_getpagesoffset: 0,
_count: 20,
'name:contains': '345',
})
.query({ _total: 'accurate', _getpagesoffset: 0, _count: 20, 'name:contains': '345' })
.reply(200, organizationSearchPage1);

render(
Expand Down Expand Up @@ -260,10 +250,7 @@ test('responds as expected to errors', async () => {

nock(props.fhirBaseURL)
.get(`/${organizationResourceType}/_search`)
.query({
_getpagesoffset: 0,
_count: 20,
})
.query({ _total: 'accurate', _getpagesoffset: 0, _count: 20 })
.replyWithError('coughid');

render(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ test('pagination and search work correctly', async () => {
nock(options.baseUrl)
.get(`/${options.endpoint}/_search`)
.query({
_total: 'accurate',
_getpagesoffset: 0,
_count: 20,
})
Expand All @@ -136,6 +137,7 @@ test('pagination and search work correctly', async () => {
nock(options.baseUrl)
.get(`/${options.endpoint}/_search`)
.query({
_total: 'accurate',
_getpagesoffset: 20,
_count: 20,
})
Expand All @@ -145,6 +147,7 @@ test('pagination and search work correctly', async () => {
nock(options.baseUrl)
.get(`/${options.endpoint}/_search`)
.query({
_total: 'accurate',
_getpagesoffset: 0,
_count: 20,
'name:contains': '345',
Expand Down

0 comments on commit 9ce0be5

Please sign in to comment.