diff --git a/public/components/datasources/components/__tests__/__snapshots__/connection_details.test.tsx.snap b/public/components/datasources/components/__tests__/__snapshots__/connection_details.test.tsx.snap new file mode 100644 index 000000000..104567f9d --- /dev/null +++ b/public/components/datasources/components/__tests__/__snapshots__/connection_details.test.tsx.snap @@ -0,0 +1,550 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`Connection Details test Renders connection details for prometheus datasource 1`] = ` + + + + + + + + + + + + + + + + + Configurations may be managed elsewhere. + + + + + + + Access to data can be managed in other systems outside of OpenSearch. Check with your administrator for additional configurations. + + + + + + + + + + + + + + + + + + + + + Data source configurations + + Control configurations for your data source. + + + + + + + + + + + + + + + + + + + + + + Data source name + + + + + prom + + + + + + + + + Data source description + + + + + - + + + + + + + + + + + + + + + + + Prometheus URI + + + + + localhost:9201 + + + + + + + + + + + + + + + + + + + + +`; + +exports[`Connection Details test Renders connection details for s3 datasource 1`] = ` + + + + + + + + + + + + + + + Configurations may be managed elsewhere. + + + + + + + Access to data can be managed in other systems outside of OpenSearch. Check with your administrator for additional configurations. + + + + + + + + + + + + + + + + + + + + + Data source configurations + + Control configurations for your data source. + + + + + + + + + + + + + + + + + + + + + + Data source name + + + + + ya + + + + + + + + + Data source description + + + + + - + + + + + + + + + + + + + + + + + Index store region + + + + + us-west-2 + + + + + + + + + Index store URI + + + + + y + + + + + + + + + + + + + + + + + + + + +`; diff --git a/public/components/datasources/components/__tests__/connection_details.test.tsx b/public/components/datasources/components/__tests__/connection_details.test.tsx new file mode 100644 index 000000000..c5a47a1f4 --- /dev/null +++ b/public/components/datasources/components/__tests__/connection_details.test.tsx @@ -0,0 +1,29 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +import { configure, mount } from 'enzyme'; +import Adapter from 'enzyme-adapter-react-16'; +import React from 'react'; +import { + testPrometheusConnectionDetails, + testS3ConnectionDetails, +} from '../../../../../test/datasources'; +import { ConnectionDetails } from '../manage/connection_details'; + +describe('Connection Details test', () => { + configure({ adapter: new Adapter() }); + + it('Renders connection details for s3 datasource', async () => { + const wrapper = mount(); + + expect(wrapper).toMatchSnapshot(); + }); + + it('Renders connection details for prometheus datasource', async () => { + const wrapper = mount(); + + expect(wrapper).toMatchSnapshot(); + }); +}); diff --git a/test/datasources.ts b/test/datasources.ts index 639a54687..6258101fc 100644 --- a/test/datasources.ts +++ b/test/datasources.ts @@ -3,6 +3,8 @@ * SPDX-License-Identifier: Apache-2.0 */ +import { DatasourceType } from '../common/types/data_connections'; + export const showDataConnectionsData = { schema: [ { @@ -51,6 +53,25 @@ export const describePrometheusDataConnection = { }, }; +export const testS3ConnectionDetails = { + dataConnection: 'ya', + description: '', + connector: 'S3GLUE' as DatasourceType, + properties: { + 'glue.indexstore.opensearch.uri': 'y', + 'glue.indexstore.opensearch.region': 'us-west-2', + }, +}; + +export const testPrometheusConnectionDetails = { + dataConnection: 'prom', + description: '', + connector: 'PROMETHEUS' as DatasourceType, + properties: { + 'prometheus.uri': 'localhost:9201', + }, +}; + export const describeS3Dataconnection = { name: 'ya', description: '',