-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: saimedhi <[email protected]> (cherry picked from commit 7cf2ac2) Co-authored-by: Sai Medhini Reddy Maryada <[email protected]>
- Loading branch information
1 parent
7576f3a
commit e63d23c
Showing
3 changed files
with
122 additions
and
0 deletions.
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
public/pages/workflows/import_workflow/import_workflow_modal.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,47 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import React from 'react'; | ||
import { render } from '@testing-library/react'; | ||
import { Provider } from 'react-redux'; | ||
import { BrowserRouter as Router, Route, Switch } from 'react-router-dom'; | ||
import { store } from '../../../store'; | ||
import { ImportWorkflowModal } from './import_workflow_modal'; | ||
|
||
jest.mock('../../../services', () => { | ||
const { mockCoreServices } = require('../../../../test'); | ||
return { | ||
...jest.requireActual('../../../services'), | ||
...mockCoreServices, | ||
}; | ||
}); | ||
|
||
const renderWithRouter = () => | ||
render( | ||
<Provider store={store}> | ||
<Router> | ||
<Switch> | ||
<Route | ||
render={() => ( | ||
<ImportWorkflowModal | ||
isImportModalOpen={true} | ||
setIsImportModalOpen={jest.fn()} | ||
setSelectedTabId={jest.fn()} | ||
/> | ||
)} | ||
/> | ||
</Switch> | ||
</Router> | ||
</Provider> | ||
); | ||
|
||
describe('ImportWorkflowModal', () => { | ||
test('renders the page', () => { | ||
const { getAllByText } = renderWithRouter(); | ||
expect( | ||
getAllByText('Import a workflow (JSON/YAML)').length | ||
).toBeGreaterThan(0); | ||
}); | ||
}); |
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,38 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import React from 'react'; | ||
import { render } from '@testing-library/react'; | ||
import '@testing-library/jest-dom'; | ||
import { Provider } from 'react-redux'; | ||
import { BrowserRouter as Router, Route, Switch } from 'react-router-dom'; | ||
import { store } from '../../../store'; | ||
import { NewWorkflow } from './new_workflow'; | ||
|
||
jest.mock('../../../services', () => { | ||
const { mockCoreServices } = require('../../../../test'); | ||
return { | ||
...jest.requireActual('../../../services'), | ||
...mockCoreServices, | ||
}; | ||
}); | ||
|
||
const renderWithRouter = () => | ||
render( | ||
<Provider store={store}> | ||
<Router> | ||
<Switch> | ||
<Route render={() => <NewWorkflow />} /> | ||
</Switch> | ||
</Router> | ||
</Provider> | ||
); | ||
|
||
describe('NewWorkflow', () => { | ||
test('renders the search bar', () => { | ||
const { getByPlaceholderText } = renderWithRouter(); | ||
expect(getByPlaceholderText('Search')).toBeInTheDocument(); | ||
}); | ||
}); |
37 changes: 37 additions & 0 deletions
37
public/pages/workflows/workflow_list/workflow_list.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,37 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
import React from 'react'; | ||
import { render } from '@testing-library/react'; | ||
import { Provider } from 'react-redux'; | ||
import { BrowserRouter as Router, Route, Switch } from 'react-router-dom'; | ||
import { store } from '../../../store'; | ||
import { WorkflowList } from './workflow_list'; | ||
|
||
jest.mock('../../../services', () => { | ||
const { mockCoreServices } = require('../../../../test'); | ||
return { | ||
...jest.requireActual('../../../services'), | ||
...mockCoreServices, | ||
}; | ||
}); | ||
|
||
const renderWithRouter = () => | ||
render( | ||
<Provider store={store}> | ||
<Router> | ||
<Switch> | ||
<Route render={() => <WorkflowList setSelectedTabId={jest.fn()} />} /> | ||
</Switch> | ||
</Router> | ||
</Provider> | ||
); | ||
|
||
describe('WorkflowList', () => { | ||
test('renders the page', () => { | ||
const { getAllByText } = renderWithRouter(); | ||
expect(getAllByText('Manage existing workflows').length).toBeGreaterThan(0); | ||
}); | ||
}); |