Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions healthcare/fhir/deleteFhirResource.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const main = (
auth: new google.auth.GoogleAuth({
scopes: ['https://www.googleapis.com/auth/cloud-platform'],
}),
responseType: 'json',
});

const deleteFhirResource = async () => {
Expand All @@ -46,10 +47,14 @@ const main = (
// fails, the server returns a 200 OK HTTP status code. To check that the
// resource was successfully deleted, search for or get the resource and
// see if it exists.
await healthcare.projects.locations.datasets.fhirStores.fhir.delete(
request
);
console.log('Deleted FHIR resource');
try {
await healthcare.projects.locations.datasets.fhirStores.fhir.delete(
request
);
console.log(`Deleted FHIR resource: ${resourceId}`);
} catch (error) {
console.error('Error deleting FHIR resource:', error.message || error);
}
};

deleteFhirResource();
Expand Down
5 changes: 4 additions & 1 deletion healthcare/fhir/system-test/fhir_resources.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,10 @@ it('should delete a FHIR resource', () => {
`node deleteFhirResource.js ${projectId} ${cloudRegion} ${datasetId} ${fhirStoreId} ${resourceType} ${resourceId}`,
{cwd}
);
assert.strictEqual(new RegExp('Deleted FHIR resource').test(output), true);
assert.strictEqual(
new RegExp(`Deleted FHIR resource: ${resourceId}`).test(output),
true
);

// Clean up
execSync(
Expand Down
Loading