Skip to content

Commit

Permalink
Added unit tests
Browse files Browse the repository at this point in the history
Signed-off-by: saimedhi <[email protected]>
  • Loading branch information
saimedhi committed Aug 29, 2024
1 parent 831f71e commit 473d6a9
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 1 deletion.
41 changes: 41 additions & 0 deletions public/pages/workflow_detail/resizable_workspace.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* 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 { ResizableWorkspace } from './resizable_workspace';
global.ResizeObserver = class {
observe() {}
unobserve() {}
disconnect() {}
};
jest.mock('../../services', () => {
const { mockCoreServices } = require('../../../test');
return {
...jest.requireActual('../../services'),
...mockCoreServices,
};
});

const renderWithRouter = () =>
render(
<Provider store={store}>
<Router>
<Switch>
<Route render={() => <ResizableWorkspace workflow={jest.fn()} />} />
</Switch>
</Router>
</Provider>
);

describe('ResizableWorkspace', () => {
test('renders the page', () => {
const { getAllByText } = renderWithRouter();
expect(getAllByText('Manage existing workflows').length).toBeGreaterThan(0);
});
});
1 change: 0 additions & 1 deletion public/pages/workflow_detail/resizable_workspace.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
*/

import React, { useRef, useState, useEffect } from 'react';
import { useSelector } from 'react-redux';
import { Form, Formik } from 'formik';
import * as yup from 'yup';
import {
Expand Down

0 comments on commit 473d6a9

Please sign in to comment.