Skip to content
Merged
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
2 changes: 1 addition & 1 deletion healthcare/hl7v2/listHl7v2Messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const main = (
const response = await healthcare.projects.locations.datasets.hl7V2Stores.messages.list(
request
);
const hl7v2Messages = response.data.messages;
const hl7v2Messages = response.data.hl7V2Messages;
console.log(`HL7v2 messages: ${hl7v2Messages.length}`);
for (const hl7v2Message of hl7v2Messages) {
console.log(hl7v2Message);
Expand Down
30 changes: 14 additions & 16 deletions healthcare/hl7v2/system-test/hl7v2_messages.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,74 +44,72 @@ before(() => {
process.env.GOOGLE_APPLICATION_CREDENTIALS,
`Must set GOOGLE_APPLICATION_CREDENTIALS environment variable!`
);
execSync(
`node createDataset.js ${projectId} ${cloudRegion} ${datasetId}`,
cwdDatasets
);
execSync(`node createDataset.js ${projectId} ${cloudRegion} ${datasetId}`, {
cwd: cwdDatasets,
});
});
after(() => {
try {
execSync(
`node deleteDataset.js ${projectId} ${cloudRegion} ${datasetId}`,
cwdDatasets
);
execSync(`node deleteDataset.js ${projectId} ${cloudRegion} ${datasetId}`, {
cwd: cwdDatasets,
});
} catch (err) {} // Ignore error
});

it('should create an HL7v2 message', () => {
execSync(
`node createHl7v2Store.js ${projectId} ${cloudRegion} ${datasetId} ${hl7v2StoreId}`,
cwd
{cwd}
);
const output = execSync(
`node createHl7v2Message.js ${projectId} ${cloudRegion} ${datasetId} ${hl7v2StoreId} ${messageFile}`,
cwd
{cwd}
);
assert.ok(output.includes('Created HL7v2 message'));
});

it('should ingest an HL7v2 message', () => {
const output = execSync(
`node ingestHl7v2Message.js ${projectId} ${cloudRegion} ${datasetId} ${hl7v2StoreId} ${messageFile}`,
cwd
{cwd}
);
assert.ok(output.includes('Ingested HL7v2 message'));
});

it('should get an HL7v2 message', () => {
const output = execSync(
`node getHl7v2Message.js ${projectId} ${cloudRegion} ${datasetId} ${hl7v2StoreId} ${messageId}`,
cwd
{cwd}
);
assert.ok(output.includes('Got HL7v2 message'));
});

it('should list HL7v2 messages', () => {
const output = execSync(
`node listHl7v2Messages.js ${projectId} ${cloudRegion} ${datasetId} ${hl7v2StoreId}`,
cwd
{cwd}
);
assert.ok(output.includes('HL7v2 messages'));
});

it('should patch an HL7v2 message', () => {
const output = execSync(
`node patchHl7v2Message.js ${projectId} ${cloudRegion} ${datasetId} ${hl7v2StoreId} ${messageId} ${labelKey} ${labelValue}`,
cwd
{cwd}
);
assert.ok(output.includes('Patched HL7v2 message'));
});

it('should delete an HL7v2 message', () => {
const output = execSync(
`node deleteHl7v2Message.js ${projectId} ${cloudRegion} ${datasetId} ${hl7v2StoreId} ${messageId}`,
cwd
{cwd}
);
assert.ok(output.includes('Deleted HL7v2 message'));

// Clean up
execSync(
`node deleteHl7v2Store.js ${projectId} ${cloudRegion} ${datasetId} ${hl7v2StoreId}`,
cwd
{cwd}
);
});
26 changes: 12 additions & 14 deletions healthcare/hl7v2/system-test/hl7v2_stores.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,50 +45,48 @@ before(async () => {
// Create a Pub/Sub topic to be used for testing.
const [topic] = await pubSubClient.createTopic(topicName);
console.log(`Topic ${topic.name} created.`);
execSync(
`node createDataset.js ${projectId} ${cloudRegion} ${datasetId}`,
cwdDatasets
);
execSync(`node createDataset.js ${projectId} ${cloudRegion} ${datasetId}`, {
cwd: cwdDatasets,
});
});
after(async () => {
try {
await pubSubClient.topic(topicName).delete();
console.log(`Topic ${topicName} deleted.`);
execSync(
`node deleteDataset.js ${projectId} ${cloudRegion} ${datasetId}`,
cwdDatasets
);
execSync(`node deleteDataset.js ${projectId} ${cloudRegion} ${datasetId}`, {
cwd: cwdDatasets,
});
} catch (err) {} // Ignore error
});

it('should create an HL7v2 store', () => {
const output = execSync(
`node createHl7v2Store.js ${projectId} ${cloudRegion} ${datasetId} ${hl7v2StoreId}`,
cwd
{cwd}
);
assert.ok(output.includes('Created HL7v2 store'));
});

it('should get an HL7v2 store', () => {
const output = execSync(
`node getHl7v2Store.js ${projectId} ${cloudRegion} ${datasetId} ${hl7v2StoreId}`,
cwd
{cwd}
);
assert.ok(output.includes('name'));
});

it('should patch an HL7v2 store', () => {
const output = execSync(
`node patchHl7v2Store.js ${projectId} ${cloudRegion} ${datasetId} ${hl7v2StoreId} ${topicName}`,
cwd
{cwd}
);
assert.ok(output.includes('Patched HL7v2 store'));
});

it('should list HL7v2 stores', () => {
const output = execSync(
`node listHl7v2Stores.js ${projectId} ${cloudRegion} ${datasetId}`,
cwd
{cwd}
);
assert.ok(output.includes('hl7V2Stores'));
});
Expand All @@ -99,7 +97,7 @@ it('should create and get an HL7v2 store IAM policy', () => {

let output = execSync(
`node setHl7v2StoreIamPolicy.js ${projectId} ${cloudRegion} ${datasetId} ${hl7v2StoreId} ${localMember} ${localRole}`,
cwd
{cwd}
);
assert.ok(output.includes, 'ETAG');

Expand All @@ -112,7 +110,7 @@ it('should create and get an HL7v2 store IAM policy', () => {
it('should delete an HL7v2 Store', () => {
const output = execSync(
`node deleteHl7v2Store ${projectId} ${cloudRegion} ${datasetId} ${hl7v2StoreId}`,
cwd
{cwd}
);
assert.ok(output.includes('Deleted HL7v2 store'));
});