-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #31312 from appsmithorg/release
27/02 Daily Promo 2nd attempt
- Loading branch information
Showing
13 changed files
with
147 additions
and
132 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
86 changes: 0 additions & 86 deletions
86
app/client/cypress/e2e/Regression/ClientSide/Onboarding/StartFromScratch_spec.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -108,7 +108,7 @@ | |
"cypress-log-to-output": "^1.1.2", | ||
"dayjs": "^1.10.6", | ||
"deep-diff": "^1.0.2", | ||
"design-system": "npm:@appsmithorg/[email protected].32", | ||
"design-system": "npm:@appsmithorg/[email protected].34", | ||
"design-system-old": "npm:@appsmithorg/[email protected]", | ||
"downloadjs": "^1.4.7", | ||
"echarts": "^5.4.2", | ||
|
@@ -250,7 +250,7 @@ | |
"@sentry/webpack-plugin": "^1.18.9", | ||
"@testing-library/jest-dom": "5.16.1", | ||
"@testing-library/react": "12.1.2", | ||
"@testing-library/react-hooks": "^7.0.2", | ||
"@testing-library/react-hooks": "^8.0.1", | ||
"@testing-library/user-event": "13.5.0", | ||
"@types/codemirror": "^0.0.96", | ||
"@types/deep-diff": "^1.0.0", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
73 changes: 73 additions & 0 deletions
73
app/client/src/ce/pages/Editor/IDE/EditorPane/__tests__/JS/JSSegment.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import React from "react"; | ||
import { renderHook, act } from "@testing-library/react-hooks"; | ||
import { useJSAdd } from "../../JS/hooks"; | ||
import { Provider } from "react-redux"; | ||
import type { Store } from "redux"; | ||
import { createStore } from "redux"; | ||
import { updateCurrentPage } from "actions/pageActions"; | ||
import rootReducer from "@appsmith/reducers"; | ||
import * as redux from "react-redux"; | ||
|
||
// Custom wrapper to provide any store to the provider | ||
function getWrapper(store: Store): React.FC { | ||
return ({ children }: { children?: React.ReactNode }) => ( | ||
<Provider store={store}>{children}</Provider> | ||
); | ||
} | ||
|
||
describe("JS Segment", () => { | ||
it("creates JS in the correct page", () => { | ||
const store = createStore(rootReducer, { | ||
entities: { | ||
pageList: { | ||
currentPageId: "1", | ||
pages: [], | ||
}, | ||
}, | ||
}); | ||
const useDispatchSpy = jest.spyOn(redux, "useDispatch"); | ||
const mockDispatchFn = jest.fn(); | ||
useDispatchSpy.mockReturnValue(mockDispatchFn); | ||
const wrapper = getWrapper(store); | ||
|
||
const { result } = renderHook(() => useJSAdd(), { wrapper }); | ||
|
||
expect(result.current).toBeDefined(); | ||
|
||
act(() => { | ||
result.current(); | ||
}); | ||
|
||
expect(mockDispatchFn).toBeCalledWith({ | ||
payload: { | ||
from: "ENTITY_EXPLORER", | ||
pageId: "1", | ||
}, | ||
type: "CREATE_NEW_JS_ACTION", | ||
}); | ||
|
||
// Update the current page | ||
act(() => { | ||
store.dispatch(updateCurrentPage("2")); | ||
}); | ||
|
||
// Render the hook because state has changed | ||
act(() => { | ||
renderHook(() => useJSAdd(), { wrapper }); | ||
}); | ||
|
||
// Call the function now from a different page | ||
act(() => { | ||
result.current(); | ||
}); | ||
|
||
// Now the creation action should have the new page id | ||
expect(mockDispatchFn).toBeCalledWith({ | ||
payload: { | ||
from: "ENTITY_EXPLORER", | ||
pageId: "2", | ||
}, | ||
type: "CREATE_NEW_JS_ACTION", | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.