-
Notifications
You must be signed in to change notification settings - Fork 906
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix WMS can't load when unable access maps services (#1550)
* Fix WMS can't load when unable access maps services Signed-off-by: Junqiu Lei <junqiu@amazon.com>
- Loading branch information
1 parent
e3b964a
commit b2cfb6e
Showing
6 changed files
with
130 additions
and
22 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
33 changes: 33 additions & 0 deletions
33
src/plugins/maps_legacy/public/common/opensearch_maps_client.test.js
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,33 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { OpenSearchMapsClient } from './opensearch_maps_client.js'; | ||
|
||
describe('opensearch_maps_client test without Internet', function () { | ||
const noInternetManifestUrl = 'https://manifest.foobar'; | ||
const defaultClientConfig = { | ||
appName: 'opensearch-dashboards', | ||
osdVersion: '1.2.3', | ||
language: 'en', | ||
landingPageUrl: '', | ||
fetchFunction: function (...args) { | ||
return fetch(...args); | ||
}, | ||
}; | ||
|
||
function makeOpenSearchMapsClient() { | ||
const openSearchMapsClient = new OpenSearchMapsClient({ | ||
...defaultClientConfig, | ||
manifestServiceUrl: noInternetManifestUrl, | ||
}); | ||
return openSearchMapsClient; | ||
} | ||
|
||
it('isEnabled() should return true when catch error', async function () { | ||
const mapsClient = makeOpenSearchMapsClient(); | ||
const osmIsEnabled = await mapsClient.isEnabled(); | ||
expect(osmIsEnabled).toEqual(true); | ||
}); | ||
}); |
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