feat: execute route and release recovery contracts
This commit is contained in:
@@ -91,4 +91,34 @@ describe("render recovery boundaries", () => {
|
||||
);
|
||||
expect(screen.getByText("recovered")).toBeVisible();
|
||||
});
|
||||
|
||||
it("resets a route failure when the registered location key changes", async () => {
|
||||
let shouldThrow = true;
|
||||
function RouteContent() {
|
||||
if (shouldThrow) throw new Error("route defect");
|
||||
return <p>next route</p>;
|
||||
}
|
||||
const view = render(
|
||||
<FeatureBoundary
|
||||
routeId="APP_HOME"
|
||||
buildId="build-a"
|
||||
resetKey="/first"
|
||||
>
|
||||
<RouteContent />
|
||||
</FeatureBoundary>,
|
||||
);
|
||||
expect(screen.getByRole("alert")).toBeVisible();
|
||||
|
||||
shouldThrow = false;
|
||||
view.rerender(
|
||||
<FeatureBoundary
|
||||
routeId="APP_HOME"
|
||||
buildId="build-a"
|
||||
resetKey="/second"
|
||||
>
|
||||
<RouteContent />
|
||||
</FeatureBoundary>,
|
||||
);
|
||||
expect(await screen.findByText("next route")).toBeVisible();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user