forked from medplum/medplum-demo-bots
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request medplum#6 from medplum/reshma-setup-bot
Adding account setup script
- Loading branch information
Showing
5 changed files
with
563 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,3 +19,5 @@ tsconfig.tsbuildinfo | |
# VSCode | ||
.vscode/ | ||
|
||
# JetBrains | ||
.idea/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | ||
}); |
Oops, something went wrong.