-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding DefaultRegistryClient unit tests
- Loading branch information
1 parent
803ddfa
commit ff3cfd2
Showing
1 changed file
with
35 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { DefaultRegistryClient } from '../../src/registry/DefaultRegistryClient'; | ||
import { loggerSpy } from '../testhelpers'; | ||
|
||
describe('DefaultRegistryClient', () => { | ||
describe('#constructor', () => { | ||
beforeEach(() => { | ||
loggerSpy.reset(); | ||
delete process.env.FPL_REGISTRY; | ||
}); | ||
afterEach(() => {}); | ||
|
||
it('should make a custom registry client when specified', () => { | ||
process.env.FPL_REGISTRY = 'https://custom-registry.example.org/'; | ||
new DefaultRegistryClient({ log: loggerSpy.log }); | ||
expect(loggerSpy.getLastMessage('info')).toBe( | ||
'Using custom registry specified by FPL_REGISTRY environment variable: https://custom-registry.example.org/' | ||
); | ||
}); | ||
|
||
it('should use the first default set for a custom registry client when specified', () => { | ||
process.env.FPL_REGISTRY = 'https://custom-registry.example.org/'; | ||
new DefaultRegistryClient({ log: loggerSpy.log }); | ||
// expect(loggerSpy.getLastMessage('info')).toBe('Using custom registry specified by FPL_REGISTRY environment variable: https://custom-registry.example.org/'); | ||
|
||
process.env.FPL_REGISTRY = 'https://custom-registry-second.example.org/'; | ||
new DefaultRegistryClient({ log: loggerSpy.log }); | ||
// expect(loggerSpy.getLastMessage('info')).toBe('Using custom registry specified by FPL_REGISTRY environment variable: https://custom-registry.example.org/'); | ||
}); | ||
|
||
it('should make a FHIR registry client when custom registry not specified', () => { | ||
new DefaultRegistryClient({ log: loggerSpy.log }); | ||
expect(loggerSpy.getLastMessage('info')).toBeUndefined(); | ||
}); | ||
}); | ||
}); |