diff --git a/src/App.test.tsx b/src/App.test.tsx
index f536b16..de5f00a 100644
--- a/src/App.test.tsx
+++ b/src/App.test.tsx
@@ -193,6 +193,31 @@ describe("App", () => {
expect(localStorage.getItem("t19.favorites")).toBe(JSON.stringify([]));
});
+ it("supports the complete library user flow without unnecessary requests", async () => {
+ const user = userEvent.setup();
+ withProviders();
+
+ await screen.findByRole("heading", { name: "A Wizard of Earthsea" });
+
+ await user.selectOptions(screen.getByRole("combobox", { name: "Subject" }), "mystery");
+ await waitFor(() => expect(getSearchRequestCount()).toBe(2));
+
+ await user.selectOptions(screen.getByRole("combobox", { name: "Sort by" }), "newest");
+ expect(
+ await screen.findByRole("heading", { name: "The Left Hand of Darkness" }),
+ ).toBeInTheDocument();
+
+ await user.selectOptions(screen.getByRole("combobox", { name: "Jump to book" }), "1");
+ expect(
+ await screen.findByRole("heading", { name: "A Wizard of Earthsea" }),
+ ).toBeInTheDocument();
+
+ await user.click(screen.getByRole("button", { name: "Add A Wizard of Earthsea to favorites" }));
+
+ expect(localStorage.getItem("t19.favorites")).toBe(JSON.stringify(["/works/OL2"]));
+ expect(getSearchRequestCount()).toBe(2);
+ });
+
it("matches the snapshot", async () => {
const { container } = withProviders();
await screen.findByRole("heading", { level: 2, name: "A Wizard of Earthsea" });