Skip to content

Commit

Permalink
Migrated object-store/object/__tests__/view.test.tsx to RTL
Browse files Browse the repository at this point in the history
  • Loading branch information
rgmacalintal committed Dec 24, 2024
1 parent 0ab98d1 commit 4364e7e
Showing 1 changed file with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { PersistedResource } from "kitsu";
import MetadataViewPage from "../../../../pages/object-store/object/view";
import { mountWithAppContext } from "../../../../test-util/mock-app-context";
import { mountWithAppContext2 } from "../../../../test-util/mock-app-context";
import { Metadata } from "../../../../types/objectstore-api";
import { fireEvent, screen } from "@testing-library/react";
import "@testing-library/jest-dom";
import userEvent from "@testing-library/user-event";

const TEST_METADATA: PersistedResource<Metadata> = {
acTags: ["tag1", "tag2"],
Expand Down Expand Up @@ -102,16 +105,15 @@ describe("Single Stored Object details page", () => {
// });

it("Renders the page.", async () => {
const wrapper = mountWithAppContext(<MetadataViewPage />, { apiContext });
const wrapper = mountWithAppContext2(<MetadataViewPage />, { apiContext });

await new Promise(setImmediate);
wrapper.update();
await new Promise(setImmediate);
expect(wrapper.find(".metadata-caption").text()).toEqual(
"Caption: Test Caption"
);

expect(wrapper.getAllByText("Caption:")[0]).toBeInTheDocument();
expect(wrapper.getAllByText("Test Caption")[0]).toBeInTheDocument();

// Shows the EXIF data:
expect(wrapper.contains("Flash did not fire")).toEqual(true);
expect(wrapper.getByText(/flash did not fire/i)).toBeInTheDocument();
});
});

0 comments on commit 4364e7e

Please sign in to comment.