[IMP] router: navigate now returns more information

This commit is contained in:
Géry Debongnie
2019-08-06 07:48:58 +02:00
parent 3db6f0a643
commit aa268937a7
2 changed files with 7 additions and 3 deletions
+4 -2
View File
@@ -138,7 +138,8 @@ describe("beforeRouteEnter", () => {
await router.start();
await router.navigate({ to: "routea" });
expect(window.location.pathname).toBe("/some/patha");
await router.navigate({ to: "routeb" });
const result = await router.navigate({ to: "routeb" });
expect(result).toBe(false);
expect(guard).toBeCalledTimes(1);
expect(window.location.pathname).toBe("/some/patha");
expect(router.currentRouteName).toBe("routea");
@@ -154,7 +155,8 @@ describe("beforeRouteEnter", () => {
]);
await router.start();
await router.navigate({ to: "routea" });
const result = await router.navigate({ to: "routea" });
expect(result).toBe(true);
expect(window.location.pathname).toBe("/some/patha");
await router.navigate({ to: "routeb" });
expect(guard).toBeCalledTimes(1);