@thepalaceproject/circulation-admin 1.12.0 → 1.13.0-post.1

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
@@ -97,7 +97,7 @@
97
97
  "eslint-plugin-react-hooks": "^4.0.0",
98
98
  "fetch-mock": "^7.3.1",
99
99
  "file-loader": "^6.2.0",
100
- "follow-redirects": "^1.7.0",
100
+ "follow-redirects": "^1.15.4",
101
101
  "husky": "^4.3.0",
102
102
  "jest": "^29.3.1",
103
103
  "jest-environment-jsdom": "^29.3.1",
@@ -141,5 +141,5 @@
141
141
  "*.{js,jsx,ts,tsx,css,md}": "prettier --write",
142
142
  "*.{js,css,md}": "prettier --write"
143
143
  },
144
- "version": "1.12.0"
144
+ "version": "1.13.0-post.1"
145
145
  }
@@ -0,0 +1,55 @@
1
+ import * as React from "react";
2
+ import { screen, waitFor } from "@testing-library/react";
3
+
4
+ import QuicksightDashboard from "../../../src/components/QuicksightDashboard";
5
+ import { LibrariesData, LibraryData } from "../../../src/interfaces";
6
+ import buildStore, { RootState } from "../../../src/store";
7
+ import { setupServer } from "msw/node";
8
+ import { rest } from "msw";
9
+ import renderWithContext from "../testUtils/renderWithContext";
10
+
11
+ const libraries: LibrariesData = { libraries: [{ uuid: "my-uuid" }] };
12
+ const dashboardId = "test";
13
+ const embedUrl = "http://embedUrl";
14
+ const dashboardUrlData = { embedUrl: embedUrl };
15
+
16
+ describe("QuicksightDashboard", () => {
17
+ const server = setupServer(
18
+ rest.get("*/admin/libraries", (req, res, ctx) => res(ctx.json(libraries))),
19
+
20
+ rest.get(
21
+ "*/admin/quicksight_embed/" +
22
+ dashboardId +
23
+ "?libraryUuids=" +
24
+ libraries["libraries"][0]["uuid"],
25
+ (req, res, ctx) => res(ctx.json(dashboardUrlData))
26
+ )
27
+ );
28
+
29
+ beforeAll(() => {
30
+ server.listen();
31
+ });
32
+
33
+ afterAll(() => {
34
+ server.close();
35
+ });
36
+
37
+ it("embed url is retrieved and set in iframe", async () => {
38
+ const contextProviderProps = {
39
+ csrfToken: "",
40
+ roles: [{ role: "system" }],
41
+ };
42
+
43
+ renderWithContext(
44
+ <QuicksightDashboard dashboardId={dashboardId} store={buildStore()} />,
45
+ contextProviderProps
46
+ );
47
+
48
+ await waitFor(() => {
49
+ expect(screen.getAllByTitle("Library Dashboard")[0]).toHaveAttribute(
50
+ "src",
51
+ embedUrl
52
+ );
53
+ });
54
+ });
55
+ });