-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prevent creating a new contact if all fields are not filled out
- Loading branch information
Showing
2 changed files
with
45 additions
and
20 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
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 |
---|---|---|
|
@@ -603,6 +603,30 @@ describe('/api/v1/patients', () => { | |
}); | ||
}); | ||
|
||
it('should not create a contact if all fields are empty strings and relationship is null', async (t) => { | ||
const app = await build(t); | ||
await t.loadFixtures(); | ||
const headers = await t.authenticate('[email protected]', 'test'); | ||
const reply = await app | ||
.inject() | ||
.patch('/api/v1/patients/27963f68-ebc1-408a-8bb5-8fbe54671064') | ||
.payload({ | ||
contactData: { | ||
firstName: '', | ||
middleName: '', | ||
lastName: '', | ||
email: '', | ||
phone: '', | ||
relationship: null, | ||
}, | ||
}) | ||
.headers(headers); | ||
|
||
assert.deepStrictEqual(reply.statusCode, StatusCodes.OK); | ||
const { emergencyContact } = JSON.parse(reply.body); | ||
assert.deepStrictEqual(emergencyContact, {}); | ||
}); | ||
|
||
it('should allow ADMIN to update a patient with medical data', async (t) => { | ||
const app = await build(t); | ||
await t.loadFixtures(); | ||
|