Skip to content

Commit

Permalink
Add new line at end of file.
Browse files Browse the repository at this point in the history
  • Loading branch information
dbernstein committed Jan 20, 2024
1 parent c5dba40 commit 9589a48
Showing 1 changed file with 22 additions and 21 deletions.
43 changes: 22 additions & 21 deletions tests/jest/components/QuicksightDashboard.test.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,29 @@
import * as React from "react";
import {screen, waitFor} from "@testing-library/react";
import { screen, waitFor } from "@testing-library/react";

import QuicksightDashboard from "../../../src/components/QuicksightDashboard";
import {LibrariesData, LibraryData} from "../../../src/interfaces";
import buildStore, {RootState} from "../../../src/store"
import {setupServer} from "msw/node";
import {rest} from "msw";
import { LibrariesData, LibraryData } from "../../../src/interfaces";
import buildStore, { RootState } from "../../../src/store";
import { setupServer } from "msw/node";
import { rest } from "msw";
import renderWithContext from "../testUtils/renderWithContext";

const libraries: LibrariesData = {libraries: [{uuid: "my-uuid"}]};
const libraries: LibrariesData = { libraries: [{ uuid: "my-uuid" }] };
const dashboardId = "test";
const embedUrl = "http://embedUrl"
const dashboardUrlData = {embedUrl: embedUrl}
const embedUrl = "http://embedUrl";
const dashboardUrlData = { embedUrl: embedUrl };

describe("QuicksightDashboard", () => {
const server = setupServer(
rest.get("*/admin/libraries", (req, res, ctx) => res(ctx.json(libraries))),

rest.get("*/admin/quicksight_embed/" + dashboardId + "?libraryUuids=" + libraries["libraries"][0]["uuid"], (req, res, ctx) => res(ctx.json(dashboardUrlData)))
rest.get("*/admin/libraries", (req, res, ctx) => res(ctx.json(libraries))),

rest.get(
"*/admin/quicksight_embed/" +
dashboardId +
"?libraryUuids=" +
libraries["libraries"][0]["uuid"],
(req, res, ctx) => res(ctx.json(dashboardUrlData))
)
);

beforeAll(() => {
Expand All @@ -29,23 +35,18 @@ describe("QuicksightDashboard", () => {
});

it("embed url is retrieved and set in iframe", async () => {

const contextProviderProps = {
csrfToken: "",
roles: [{role: "system"}],

roles: [{ role: "system" }],
};

renderWithContext(
<QuicksightDashboard
dashboardId={dashboardId}
store={buildStore()}
/>,
contextProviderProps
<QuicksightDashboard dashboardId={dashboardId} store={buildStore()} />,
contextProviderProps
);

await waitFor(() => {
expect(screen.getByRole('iframe')).toHaveAttribute("src", embedUrl)
expect(screen.getByRole("iframe")).toHaveAttribute("src", embedUrl);
});
});
});
});

0 comments on commit 9589a48

Please sign in to comment.