diff --git a/app/client/src/components/formControls/RadioButtonControl.test.tsx b/app/client/src/components/formControls/RadioButtonControl.test.tsx index 03077c379b1..6e8ee237903 100644 --- a/app/client/src/components/formControls/RadioButtonControl.test.tsx +++ b/app/client/src/components/formControls/RadioButtonControl.test.tsx @@ -115,4 +115,4 @@ describe("RadioButtonControl", () => { expect(options[1]).toBeChecked(); expect(options[2]).not.toBeChecked(); }); -}); +}); \ No newline at end of file diff --git a/app/client/src/components/formControls/RadioButtonControl.tsx b/app/client/src/components/formControls/RadioButtonControl.tsx index ecee054f58c..9a2fe355d28 100644 --- a/app/client/src/components/formControls/RadioButtonControl.tsx +++ b/app/client/src/components/formControls/RadioButtonControl.tsx @@ -62,7 +62,6 @@ function renderComponent(props: renderComponentProps) { ); } - export interface RadioButtonControlProps extends ControlProps { options: SelectOptionProps[]; } diff --git a/app/client/src/pages/Editor/DataSourceEditor/index.tsx b/app/client/src/pages/Editor/DataSourceEditor/index.tsx index 2d07855c50e..64bf1916ee8 100644 --- a/app/client/src/pages/Editor/DataSourceEditor/index.tsx +++ b/app/client/src/pages/Editor/DataSourceEditor/index.tsx @@ -162,7 +162,6 @@ type Props = ReduxStateProps & }>; export const DSEditorWrapper = styled.div` - height: calc(100vh - ${(props) => props.theme.headerHeight}); overflow: hidden; display: flex; flex-direction: row; diff --git a/app/client/src/pages/Editor/QueryEditor/QueryDebuggerTabs.test.tsx b/app/client/src/pages/Editor/QueryEditor/QueryDebuggerTabs.test.tsx index 23de0834cd0..c7620701fe4 100644 --- a/app/client/src/pages/Editor/QueryEditor/QueryDebuggerTabs.test.tsx +++ b/app/client/src/pages/Editor/QueryEditor/QueryDebuggerTabs.test.tsx @@ -1,18 +1,46 @@ import React from "react"; -import { render } from "@testing-library/react"; +import { render, screen } from "@testing-library/react"; import configureStore from "redux-mock-store"; import { Provider } from "react-redux"; +import type { AnyAction, Store } from "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 QueryDebuggerTabs from "./QueryDebuggerTabs"; +import type { ActionResponse } from "api/ActionAPI"; import { ENTITY_TYPE } from "ee/entities/AppsmithConsole/utils"; +import { EditorViewMode } from "ee/entities/IDE/constants"; const mockStore = configureStore([]); +const mockSuccessResponse: ActionResponse = { + body: ["Record 1", "Record 2"], + statusCode: "200", + dataTypes: [], + duration: "3000", + size: "200", + isExecutionSuccess: true, + headers: { + "Content-Type": ["application/json"], + "Cache-Control": ["no-cache"], + }, +}; + +const mockFailedResponse: ActionResponse = { + body: [{ response: "Failed" }], + statusCode: "200", + dataTypes: [], + duration: "3000", + size: "200", + isExecutionSuccess: false, + headers: { + "Content-Type": ["application/json"], + "Cache-Control": ["no-cache"], + }, +}; + const storeState = { ...unitTestBaseMockStore, evaluations: { @@ -53,9 +81,7 @@ const storeState = { }; describe("ApiResponseView", () => { - // TODO: Fix this the next time the file is edited - // eslint-disable-next-line @typescript-eslint/no-explicit-any - let store: any; + let store: Store; beforeEach(() => { store = mockStore(storeState); @@ -87,4 +113,60 @@ describe("ApiResponseView", () => { ?.classList.contains("select-text"), ).toBe(true); }); + + it("should show record count as result if the query response returns records", () => { + render( + + + + {}} + /> + + + , + ); + + const expectedResultText = "Result: 2 Records"; + const resultTextElement = screen.getByTestId("result-text"); + + expect(resultTextElement).toBeInTheDocument(); + expect(resultTextElement?.textContent).toContain(expectedResultText); + }); + + it("should show error as result if the query response returns the error", () => { + render( + + + + {}} + /> + + + , + ); + + const expectedResultText = "Result: Error"; + const resultTextElement = screen.getByTestId("result-text"); + + expect(resultTextElement).toBeInTheDocument(); + expect(resultTextElement?.textContent).toContain(expectedResultText); + }); }); diff --git a/app/client/src/pages/Editor/QueryEditor/QueryDebuggerTabs.tsx b/app/client/src/pages/Editor/QueryEditor/QueryDebuggerTabs.tsx index 7d283d140f5..36b4be09717 100644 --- a/app/client/src/pages/Editor/QueryEditor/QueryDebuggerTabs.tsx +++ b/app/client/src/pages/Editor/QueryEditor/QueryDebuggerTabs.tsx @@ -269,11 +269,17 @@ function QueryDebuggerTabs({ > {output && !!output.length && ( - + Result: - {` ${output.length} Record${ - output.length > 1 ? "s" : "" - }`} + {actionResponse?.isExecutionSuccess ? ( + {` ${output.length} Record${ + output.length > 1 ? "s" : "" + }`} + ) : ( + + {" Error"} + + )} )}