Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: New query button does not show up issue fixed #36766

Merged
merged 1 commit into from
Oct 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions app/client/src/ce/hooks/hooks.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { useEditorType, EditorNames } from "./index";
import {
BUILDER_VIEWER_PATH_PREFIX,
BUILDER_BASE_PATH_DEPRECATED,
} from "constants/routes";

describe("useEditorType", () => {
it('should return "app" for BUILDER_VIEWER_PATH_PREFIX', () => {
const result = useEditorType(BUILDER_VIEWER_PATH_PREFIX);

expect(result).toBe(EditorNames.APPLICATION);
});

it('should return "app" for BUILDER_BASE_PATH_DEPRECATED', () => {
const result = useEditorType(BUILDER_BASE_PATH_DEPRECATED);

expect(result).toBe(EditorNames.APPLICATION);
});

it('should default to "app" for unmatched paths', () => {
const result = useEditorType("/some-random-path");

expect(result).toBe(EditorNames.APPLICATION);
});
});
1 change: 1 addition & 0 deletions app/client/src/ce/hooks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export interface EditorType {

export const editorType: EditorType = {
[BUILDER_VIEWER_PATH_PREFIX]: EditorNames.APPLICATION,
[BUILDER_BASE_PATH_DEPRECATED]: EditorNames.APPLICATION,
};

export const useEditorType = (path: string) => {
Expand Down
Loading