Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions src/common/__tests__/appUrls.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ test('localhost points to the local TermBrowser', () => {
assert.equal(resolveV3URL('', 'http://localhost:4004', 'localhost:4004'), 'http://localhost:4002')
})

test('official Mapper hosts map to the matching TermBrowser environment', () => {
assert.equal(resolveV3URL('', 'https://map.openconceptlab.org', 'map.openconceptlab.org'), 'https://app.v3.openconceptlab.org')
assert.equal(resolveV3URL('', 'https://map.qa.openconceptlab.org', 'map.qa.openconceptlab.org'), 'https://app.v3.qa.openconceptlab.org')
assert.equal(resolveV3URL(undefined, 'https://map.staging.who.openconceptlab.org', 'map.staging.who.openconceptlab.org'), 'https://app.v3.staging.who.openconceptlab.org')
test('official Mapper hosts map to the matching TermBrowser environment at app.<env>', () => {
assert.equal(resolveV3URL('', 'https://map.openconceptlab.org', 'map.openconceptlab.org'), 'https://app.openconceptlab.org')
assert.equal(resolveV3URL('', 'https://map.qa.openconceptlab.org', 'map.qa.openconceptlab.org'), 'https://app.qa.openconceptlab.org')
assert.equal(resolveV3URL('', 'https://map.staging.openconceptlab.org', 'map.staging.openconceptlab.org'), 'https://app.staging.openconceptlab.org')
assert.equal(resolveV3URL(undefined, 'https://map.staging.who.openconceptlab.org', 'map.staging.who.openconceptlab.org'), 'https://app.staging.who.openconceptlab.org')
})

test('custom hosts without configuration point to production', () => {
Expand All @@ -26,7 +27,7 @@ test('an integrated TermBrowser needs configuration or an official Mapper host',
assert.equal(resolveIntegratedV3URL('https://tb.example.org/', 'https://mapper.example.org', 'mapper.example.org'), 'https://tb.example.org')
assert.equal(resolveIntegratedV3URL('http://localhost:4002', 'http://localhost:4004', 'localhost:4004'), 'http://localhost:4002')
assert.equal(resolveIntegratedV3URL('', 'http://localhost:4004', 'localhost:4004'), '', 'a standalone local Mapper keeps its own pages')
assert.equal(resolveIntegratedV3URL('', 'https://map.qa.openconceptlab.org', 'map.qa.openconceptlab.org'), 'https://app.v3.qa.openconceptlab.org')
assert.equal(resolveIntegratedV3URL('', 'https://map.qa.openconceptlab.org', 'map.qa.openconceptlab.org'), 'https://app.qa.openconceptlab.org')
assert.equal(resolveIntegratedV3URL('', 'https://mapper.example.org', 'mapper.example.org'), '')
assert.equal(resolveIntegratedV3URL('', undefined, undefined), '')
})
4 changes: 2 additions & 2 deletions src/common/appUrls.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const PRODUCTION_TERMBROWSER_URL = 'https://app.v3.openconceptlab.org'
export const PRODUCTION_TERMBROWSER_URL = 'https://app.openconceptlab.org'

const OFFICIAL_MAPPER_ORIGIN = /^https:\/\/map\.([a-z]+\.)*openconceptlab\.org$/

Expand All @@ -9,7 +9,7 @@ export const resolveIntegratedV3URL = (configured, origin) => {
if(url)
return url
if(OFFICIAL_MAPPER_ORIGIN.test(origin || ''))
return origin.replace('//map.', '//app.v3.')
return origin.replace('//map.', '//app.')
return ''
}

Expand Down
Loading