forked from medplum/medplum
-
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.
feat(server): add
disableGravatarProfiles
to Project settings (medp…
- Loading branch information
1 parent
6c9c842
commit 437b575
Showing
3 changed files
with
59 additions
and
1 deletion.
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
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,55 @@ | ||
import express from 'express'; | ||
import { initApp, shutdownApp } from './app'; | ||
import { createProfile } from './auth/utils'; | ||
import { MedplumServerConfig, loadTestConfig } from './config'; | ||
import { createTestProject, withTestContext } from './test.setup'; | ||
|
||
describe('Utils', () => { | ||
let app: express.Express; | ||
let config: MedplumServerConfig; | ||
|
||
beforeAll(async () => { | ||
app = express(); | ||
config = await loadTestConfig(); | ||
await initApp(app, config); | ||
}); | ||
|
||
afterAll(async () => { | ||
await shutdownApp(); | ||
}); | ||
|
||
describe('createProfile', () => { | ||
test('disableGravatarProfiles -- true', async () => { | ||
const { project } = await withTestContext(async () => | ||
createTestProject({ | ||
project: { | ||
setting: [{ name: 'disableGravatarProfiles', valueBoolean: true }], | ||
}, | ||
}) | ||
); | ||
const profile = await createProfile(project, 'Patient', 'Alice', 'Doe', '[email protected]'); | ||
expect(profile.photo).toBeUndefined(); | ||
}); | ||
|
||
test.each([false, undefined])('disableGravatarProfiles -- %s', async (val) => { | ||
const { project } = await withTestContext(async () => | ||
createTestProject({ | ||
project: | ||
val !== undefined | ||
? { | ||
setting: [{ name: 'disableGravatarProfiles', valueBoolean: val }], | ||
} | ||
: {}, | ||
}) | ||
); | ||
const profile = await createProfile(project, 'Patient', 'Alice', 'Doe', '[email protected]'); | ||
expect(profile.photo).toEqual([ | ||
{ | ||
contentType: 'image/png', | ||
title: 'profile.png', | ||
url: 'https://gravatar.com/avatar/ff8d9819fc0e12bf0d24892e45987e249a28dce836a85cad60e28eaaa8c6d976?s=256&r=pg&d=retro', | ||
}, | ||
]); | ||
}); | ||
}); | ||
}); |