Skip to content

Commit

Permalink
fix: New query button does not show up issue fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
“sneha122” committed Oct 8, 2024
1 parent 8463d02 commit 015ef2a
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
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

0 comments on commit 015ef2a

Please sign in to comment.