PromucFlow_constructor/app/client/src/components/editorComponents/ApiResponseView.test.tsx
Rudraprasad Das 9ce2598e76
chore: git mod - integration with applications (#38439)
## Description
- Git mod integration with applications behind feature flag

Fixes #37815 
Fixes #37816 
Fixes #37817 
Fixes #37818 
Fixes #37819 
Fixes #37820 

## Automation

/ok-to-test tags="@tag.All"

### 🔍 Cypress test results
<!-- This is an auto-generated comment: Cypress test results  -->
> [!TIP]
> 🟢 🟢 🟢 All cypress tests have passed! 🎉 🎉 🎉
> Workflow run:
<https://github.com/appsmithorg/appsmith/actions/runs/12570655268>
> Commit: 7d2f1a7013bc2fc6c960699ee0b6e06800cd21f9
> <a
href="https://internal.appsmith.com/app/cypress-dashboard/rundetails-65890b3c81d7400d08fa9ee5?branch=master&workflowId=12570655268&attempt=2"
target="_blank">Cypress dashboard</a>.
> Tags: `@tag.All`
> Spec:
> <hr>Wed, 01 Jan 2025 14:35:46 UTC
<!-- end of auto-generated comment: Cypress test results  -->


## Communication
Should the DevRel and Marketing teams inform users about this change?
- [ ] Yes
- [ ] No
2025-01-05 11:21:23 +01:00

104 lines
2.5 KiB
TypeScript

import React from "react";
import { render } from "@testing-library/react";
import ApiResponseView from "./ApiResponseView";
import configureStore from "redux-mock-store";
import { Provider } from "react-redux";
import { ThemeProvider } from "styled-components";
import { unitTestBaseMockStore } from "layoutSystems/common/dropTarget/unitTestUtils";
import { lightTheme } from "selectors/themeSelectors";
import { BrowserRouter as Router } from "react-router-dom";
import { EditorViewMode } from "ee/entities/IDE/constants";
import "@testing-library/jest-dom/extend-expect";
import { APIFactory } from "test/factories/Actions/API";
import { noop } from "lodash";
jest.mock("./EntityBottomTabs", () => ({
__esModule: true,
default: () => <div />,
}));
jest.mock("selectors/gitModSelectors", () => ({
selectCombinedPreviewMode: jest.fn(() => false),
}));
const mockStore = configureStore([]);
const storeState = {
...unitTestBaseMockStore,
evaluations: {
tree: {},
},
ui: {
...unitTestBaseMockStore.ui,
gitSync: {
branches: [],
fetchingBranches: false,
isDeploying: false,
protectedBranchesLoading: false,
protectedBranches: [],
},
editor: {
isPreviewMode: false,
},
users: {
featureFlag: {
data: {},
overriddenFlags: {},
},
},
ide: {
view: EditorViewMode.FullScreen,
},
debugger: {
context: {
errorCount: 0,
},
},
pluginActionEditor: {
debugger: {
open: true,
responseTabHeight: 200,
selectedTab: "response",
},
},
},
};
describe("ApiResponseView", () => {
// TODO: Fix this the next time the file is edited
// eslint-disable-next-line @typescript-eslint/no-explicit-any
let store: any;
beforeEach(() => {
store = mockStore(storeState);
});
it("the container should have class select-text to enable the selection of text for user", () => {
const Api1 = APIFactory.build({
id: "api_id",
baseId: "api_base_id",
pageId: "pageId",
});
const { container } = render(
<Provider store={store}>
<ThemeProvider theme={lightTheme}>
<Router>
<ApiResponseView
currentActionConfig={Api1}
isRunDisabled={false}
isRunning={false}
onRunClick={noop}
/>
</Router>
</ThemeProvider>
</Provider>,
);
expect(
container
.querySelector(".t--ide-bottom-view")
?.classList.contains("select-text"),
).toBe(true);
});
});