saleor-dashboard/src/new-apps/urls.test.ts
Lukasz Ostrowski 4ae2748e8e
Refactor app actions handling (#3042)
* Update app-sdk

* extract useHandleNotificationAction

* Extract useUpdateRoutingAction hook

* extract redirect action

* Extract isAppDeepUrlChange to AppUrls

* Rewrite redirection logic

* Remove useCallback

* add tests

* finish tests

* refactor trycatch

* Fix actions respond calls

* Fix how route is resolved for updateRouting
2023-01-27 16:21:19 +01:00

20 lines
592 B
TypeScript

import { AppUrls } from "@dashboard/new-apps/urls";
describe("AppUrls (apps/urls.ts)", () => {
describe("isAppDeepUrlChange", () => {
it("Returns true if only nested app path changes", () => {
expect(
AppUrls.isAppDeepUrlChange(
"XYZ",
"/apps/XYZ/app/configuration",
"/apps/XYZ/app/error",
),
).toBe(true);
});
it("Returns false if dashboard path changes outside of app path", () => {
expect(
AppUrls.isAppDeepUrlChange("XYZ", "/apps/XYZ/configuration", "/orders"),
).toBe(false);
});
});
});