@thepalaceproject/circulation-admin 1.21.0-post.3 → 1.21.0-post.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -149,5 +149,5 @@
149
149
  "*.{js,jsx,ts,tsx,css,md}": "prettier --write",
150
150
  "*.{js,css,md}": "prettier --write"
151
151
  },
152
- "version": "1.21.0-post.3"
152
+ "version": "1.21.0-post.6"
153
153
  }
@@ -80,6 +80,40 @@ describe("BookDetails", () => {
80
80
  fetchMock.restore();
81
81
  });
82
82
 
83
+ it("don't show hide button if not a library's admin", () => {
84
+ const { queryByRole } = renderWithProviders(
85
+ <BookDetailsEditor
86
+ bookData={{ id: "id", title: "title", suppressPerLibraryLink }}
87
+ bookUrl="url"
88
+ csrfToken="token"
89
+ canSuppress={false}
90
+ {...dispatchProps}
91
+ />
92
+ );
93
+ const hideButton = queryByRole("button", { name: "Hide" });
94
+ const restoreButton = queryByRole("button", { name: "Restore" });
95
+
96
+ expect(hideButton).to.be.null;
97
+ expect(restoreButton).to.be.null;
98
+ });
99
+
100
+ it("don't show restore button if not a library's admin", () => {
101
+ const { queryByRole } = renderWithProviders(
102
+ <BookDetailsEditor
103
+ bookData={{ id: "id", title: "title", unsuppressPerLibraryLink }}
104
+ bookUrl="url"
105
+ csrfToken="token"
106
+ canSuppress={false}
107
+ {...dispatchProps}
108
+ />
109
+ );
110
+ const hideButton = queryByRole("button", { name: "Hide" });
111
+ const restoreButton = queryByRole("button", { name: "Restore" });
112
+
113
+ expect(hideButton).to.be.null;
114
+ expect(restoreButton).to.be.null;
115
+ });
116
+
83
117
  it("uses modal for suppress book confirmation", async () => {
84
118
  // Configure standard constructors so that RTK Query works in tests with FetchMockJest
85
119
  Object.assign(fetchMock.config, {
@@ -96,6 +130,7 @@ describe("BookDetails", () => {
96
130
  bookData={{ id: "id", title: "title", suppressPerLibraryLink }}
97
131
  bookUrl="url"
98
132
  csrfToken="token"
133
+ canSuppress={true}
99
134
  {...dispatchProps}
100
135
  />
101
136
  );
@@ -154,6 +189,7 @@ describe("BookDetails", () => {
154
189
  bookData={{ id: "id", title: "title", unsuppressPerLibraryLink }}
155
190
  bookUrl="url"
156
191
  csrfToken="token"
192
+ canSuppress={true}
157
193
  {...dispatchProps}
158
194
  />
159
195
  );