forked from opensearch-project/dashboards-observability
-
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.
[Backport 2.x] Refactor integrations setup for easier separation of d…
…ifferent setup options (opensearch-project#1741) * Refactor addIntegrationRequest params to object * Move SetupIntegrationFormInputs to own file * Split form inputs into more sections visually * Split form inputs into more sections logically * Minor copy update for checkpoint location * Update toggleworkflow method per Ryan's feedback --------- (cherry picked from commit d131d99) Signed-off-by: Simeon Widdis <[email protected]> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> (cherry picked from commit 2046537)
- Loading branch information
1 parent
0cff4a8
commit 796cc34
Showing
8 changed files
with
3,537 additions
and
3,908 deletions.
There are no files selected for viewing
4,005 changes: 533 additions & 3,472 deletions
4,005
...omponents/integrations/components/__tests__/__snapshots__/setup_integration.test.tsx.snap
Large diffs are not rendered by default.
Oops, something went wrong.
2,374 changes: 2,374 additions & 0 deletions
2,374
...ts/integrations/components/__tests__/__snapshots__/setup_integration_inputs.test.tsx.snap
Large diffs are not rendered by default.
Oops, something went wrong.
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
136 changes: 136 additions & 0 deletions
136
public/components/integrations/components/__tests__/setup_integration_inputs.test.tsx
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,136 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import { configure, mount, shallow } from 'enzyme'; | ||
import Adapter from 'enzyme-adapter-react-16'; | ||
import React from 'react'; | ||
import { waitFor } from '@testing-library/react'; | ||
import { | ||
IntegrationConnectionInputs, | ||
IntegrationDetailsInputs, | ||
IntegrationQueryInputs, | ||
IntegrationWorkflowsInputs, | ||
SetupIntegrationFormInputs, | ||
} from '../setup_integration_inputs'; | ||
import { | ||
TEST_INTEGRATION_CONFIG, | ||
TEST_INTEGRATION_SETUP_INPUTS, | ||
} from '../../../../../test/constants'; | ||
|
||
describe('Integration Setup Inputs', () => { | ||
configure({ adapter: new Adapter() }); | ||
|
||
it('Renders the index form as expected', async () => { | ||
const wrapper = shallow( | ||
<SetupIntegrationFormInputs | ||
config={TEST_INTEGRATION_SETUP_INPUTS} | ||
updateConfig={() => {}} | ||
integration={TEST_INTEGRATION_CONFIG} | ||
setupCallout={{ show: false }} | ||
/> | ||
); | ||
|
||
await waitFor(() => { | ||
expect(wrapper).toMatchSnapshot(); | ||
}); | ||
}); | ||
|
||
it('Renders the S3 connector form as expected', async () => { | ||
const wrapper = shallow( | ||
<SetupIntegrationFormInputs | ||
config={{ ...TEST_INTEGRATION_SETUP_INPUTS, connectionType: 's3' }} | ||
updateConfig={() => {}} | ||
integration={TEST_INTEGRATION_CONFIG} | ||
setupCallout={{ show: false }} | ||
/> | ||
); | ||
|
||
await waitFor(() => { | ||
expect(wrapper).toMatchSnapshot(); | ||
}); | ||
}); | ||
|
||
it('Renders the S3 connector form without workflows', async () => { | ||
const wrapper = shallow( | ||
<SetupIntegrationFormInputs | ||
config={{ ...TEST_INTEGRATION_SETUP_INPUTS, connectionType: 's3' }} | ||
updateConfig={() => {}} | ||
integration={TEST_INTEGRATION_CONFIG} | ||
setupCallout={{ show: false }} | ||
/> | ||
); | ||
|
||
await waitFor(() => { | ||
expect(wrapper).toMatchSnapshot(); | ||
}); | ||
}); | ||
|
||
it('Renders the details inputs', async () => { | ||
const wrapper = mount( | ||
<IntegrationDetailsInputs | ||
config={{ ...TEST_INTEGRATION_SETUP_INPUTS, connectionType: 's3' }} | ||
updateConfig={() => {}} | ||
integration={TEST_INTEGRATION_CONFIG} | ||
/> | ||
); | ||
|
||
await waitFor(() => { | ||
expect(wrapper).toMatchSnapshot(); | ||
}); | ||
}); | ||
|
||
it('Renders the connection inputs', async () => { | ||
const wrapper = mount( | ||
<IntegrationConnectionInputs | ||
config={{ ...TEST_INTEGRATION_SETUP_INPUTS, connectionType: 's3' }} | ||
updateConfig={() => {}} | ||
integration={TEST_INTEGRATION_CONFIG} | ||
/> | ||
); | ||
|
||
await waitFor(() => { | ||
expect(wrapper).toMatchSnapshot(); | ||
}); | ||
}); | ||
|
||
it('Renders the connection inputs with a locked connection type', async () => { | ||
const wrapper = mount( | ||
<IntegrationConnectionInputs | ||
config={{ ...TEST_INTEGRATION_SETUP_INPUTS, connectionType: 's3' }} | ||
updateConfig={() => {}} | ||
integration={TEST_INTEGRATION_CONFIG} | ||
lockConnectionType={true} | ||
/> | ||
); | ||
|
||
await waitFor(() => { | ||
expect(wrapper).toMatchSnapshot(); | ||
}); | ||
}); | ||
|
||
it('Renders the query inputs', async () => { | ||
const wrapper = mount( | ||
<IntegrationQueryInputs | ||
config={{ ...TEST_INTEGRATION_SETUP_INPUTS, connectionType: 's3' }} | ||
updateConfig={() => {}} | ||
integration={TEST_INTEGRATION_CONFIG} | ||
/> | ||
); | ||
|
||
await waitFor(() => { | ||
expect(wrapper).toMatchSnapshot(); | ||
}); | ||
}); | ||
|
||
it('Renders the workflows inputs', async () => { | ||
const wrapper = mount( | ||
<IntegrationWorkflowsInputs updateConfig={() => {}} integration={TEST_INTEGRATION_CONFIG} /> | ||
); | ||
|
||
await waitFor(() => { | ||
expect(wrapper).toMatchSnapshot(); | ||
}); | ||
}); | ||
}); |
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
Oops, something went wrong.