forked from opensearch-project/OpenSearch-Dashboards
-
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.
Fix WMS can't load when unable access maps services (opensearch-proje…
…ct#1550) (opensearch-project#1707) * Fix WMS can't load when unable access maps services Signed-off-by: Junqiu Lei <junqiu@amazon.com> (cherry picked from commit b2cfb6e)
- Loading branch information
1 parent
e20cf92
commit 7ab24c5
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