From 82df60907241cb07562cbfd09d9c656656955adb Mon Sep 17 00:00:00 2001 From: karanh37 <33024356+karanh37@users.noreply.github.com> Date: Tue, 27 Jun 2023 20:48:00 +0530 Subject: [PATCH] fix: scrolling behavior feedback on mydata page (#12176) --- .../AppContainer/AppContainer.test.tsx | 98 +++++++++++++++++++ .../components/AppContainer/AppContainer.tsx | 2 +- .../AppContainer/app-container.less | 5 +- .../src/components/Explore/Explore.style.less | 30 ------ .../components/ExploreV1/ExploreV1.style.less | 4 + 5 files changed, 107 insertions(+), 32 deletions(-) create mode 100644 openmetadata-ui/src/main/resources/ui/src/components/AppContainer/AppContainer.test.tsx delete mode 100644 openmetadata-ui/src/main/resources/ui/src/components/Explore/Explore.style.less diff --git a/openmetadata-ui/src/main/resources/ui/src/components/AppContainer/AppContainer.test.tsx b/openmetadata-ui/src/main/resources/ui/src/components/AppContainer/AppContainer.test.tsx new file mode 100644 index 00000000000..9b4e97c8251 --- /dev/null +++ b/openmetadata-ui/src/main/resources/ui/src/components/AppContainer/AppContainer.test.tsx @@ -0,0 +1,98 @@ +/* + * Copyright 2023 Collate. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { render, screen } from '@testing-library/react'; +import { ROUTES } from 'constants/constants'; +import React from 'react'; +import { MemoryRouter, Switch } from 'react-router-dom'; +import AppContainer from './AppContainer'; + +jest.mock('../../AppState', () => ({ + getCurrentUserDetails: jest.fn().mockReturnValue({ + id: '2e424734-761a-443f-bf2a-a5b361823c80', + type: 'user', + name: 'aaron_johnson0', + fullyQualifiedName: 'aaron_johnson0', + displayName: 'Aaron Johnson', + deleted: false, + }), + newUser: { + name: 'Sample Name', + email: 'sample123@sample.com', + picture: 'Profile Picture', + }, +})); + +jest.mock('../authentication/auth-provider/AuthProvider', () => { + return { + useAuthContext: jest.fn(() => ({ + isAuthDisabled: false, + isAuthenticated: true, + signingIn: false, + isProtectedRoute: jest.fn().mockReturnValue(true), + isTourRoute: jest.fn().mockReturnValue(false), + onLogoutHandler: jest.fn(), + })), + }; +}); + +jest.mock('../../hooks/authHooks', () => ({ + useAuth: () => { + return { + isSignedIn: true, + isSignedOut: false, + isAuthenticatedRoute: true, + isAuthDisabled: true, + }; + }, +})); + +jest.mock('components/MyData/LeftSidebar/LeftSidebar.component', () => + jest.fn().mockReturnValue(
Sidebar
) +); + +jest.mock('components/AppBar/Appbar', () => + jest.fn().mockReturnValue(Appbar
) +); + +jest.mock('pages/signup', () => jest.fn().mockReturnValue(SignUpPage
)); + +jest.mock('components/router/AuthenticatedAppRouter', () => + jest.fn().mockReturnValue(AuthenticatedAppRouter
) +); + +describe('AppContainer', () => { + it('renders the SignupPage when on the signup route', () => { + render( +