Skip to content

Commit

Permalink
Merge pull request medplum#6 from medplum/reshma-setup-bot
Browse files Browse the repository at this point in the history
Adding account setup script
  • Loading branch information
reshmakh committed Jul 22, 2022
2 parents 152a073 + c95b221 commit efa9859
Show file tree
Hide file tree
Showing 5 changed files with 563 additions and 13 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,5 @@ tsconfig.tsbuildinfo
# VSCode
.vscode/

# JetBrains
.idea/
26 changes: 13 additions & 13 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,20 +14,20 @@
"author": "Medplum <[email protected]>",
"license": "Apache-2.0",
"devDependencies": {
"@medplum/cli": "0.9.19",
"@medplum/core": "0.9.19",
"@medplum/fhirtypes": "0.9.19",
"@medplum/mock": "0.9.19",
"@types/node": "17.0.33",
"c8": "7.11.2",
"eslint": "8.15.0",
"@medplum/cli": "0.9.27",
"@medplum/core": "0.9.27",
"@medplum/fhirtypes": "0.9.27",
"@medplum/mock": "0.9.27",
"@types/node": "18.0.6",
"c8": "7.12.0",
"eslint": "8.20.0",
"eslint-config-prettier": "8.5.0",
"eslint-plugin-prettier": "4.0.0",
"node-fetch": "3.2.4",
"prettier": "2.6.2",
"typescript": "4.6.4",
"vitest": "0.12.6",
"@vitest/ui": "0.17.0"
"eslint-plugin-prettier": "4.2.1",
"node-fetch": "3.2.9",
"prettier": "2.7.1",
"typescript": "4.7.4",
"vitest": "0.18.1",
"@vitest/ui": "0.18.1"
},
"eslintConfig": {
"parser": "@typescript-eslint/parser",
Expand Down
23 changes: 23 additions & 0 deletions src/sample-account-setup.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { BotEvent } from '@medplum/core';
import { Patient } from '@medplum/fhirtypes';
import { MockClient } from '@medplum/mock';
import { expect } from 'vitest';
import { handler } from './sample-account-setup';

test('New patient', async () => {
const medplum = new MockClient();
const patient = await medplum.createResource<Patient>({
resourceType: 'Patient',
name: [{ given: ['John'], family: 'Doe' }],
});

const event: BotEvent = { contentType: 'application/fhir+json', input: patient };
await handler(medplum, event);

const check = await medplum.readResource('Patient', patient.id as string);
expect(check.generalPractitioner).toBeDefined();
expect(check.generalPractitioner).toHaveLength(1);

const observations = await medplum.searchResources('Observation', 'subject=Patient/' + patient.id);
expect(observations).toHaveLength(7);
});
Loading

0 comments on commit efa9859

Please sign in to comment.