Skip to content

Commit

Permalink
test: added test fixture for UmbracoRichText
Browse files Browse the repository at this point in the history
  • Loading branch information
fbosch committed May 17, 2024
1 parent f5bc38e commit c705886
Show file tree
Hide file tree
Showing 3 changed files with 2,553 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/__tests__/UmbracoRichText.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// @vitest-environment happy-dom
import { render, screen } from "@testing-library/react";
import { type RichTextElementModel, UmbracoRichText } from "../UmbracoRichText";
import fixture from "./__fixtures__/UmbracoRichText.fixture.json";

/**
* Creates nested RichTextElementModel objects with the given tags.
Expand Down Expand Up @@ -238,3 +239,14 @@ it("should render default node if renderNode prop returns undefined", () => {
);
expect(screen.queryByTestId("default-rendering")).not.toBeNull();
});

it("should render fixture content correctly", () => {
// biome-ignore lint/suspicious/noExplicitAny:

Check warning on line 244 in src/__tests__/UmbracoRichText.test.tsx

View workflow job for this annotation

GitHub Actions / build

Suppression comment is not being used
const container = render(
<UmbracoRichText
data={fixture as any}

Check failure on line 247 in src/__tests__/UmbracoRichText.test.tsx

View workflow job for this annotation

GitHub Actions / build

Unexpected any. Specify a different type.
renderBlock={() => <div data-testid="block" />}
/>,
);
expect(container).toMatchSnapshot();
});
Loading

0 comments on commit c705886

Please sign in to comment.