Skip to content

Commit

Permalink
Merge pull request #2 from charlie-tango/feature/test-fixture-umbraco…
Browse files Browse the repository at this point in the history
…-rich-text

Test Fixture for UmbracoRichText
  • Loading branch information
fbosch authored May 29, 2024
2 parents f5bc38e + 51a30cb commit 7ee53e0
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", () => {
const container = render(
<UmbracoRichText
// biome-ignore lint/suspicious/noExplicitAny:
data={fixture as any}
renderBlock={() => <div data-testid="block" />}
/>,
);
expect(container).toMatchSnapshot();
});
Loading

0 comments on commit 7ee53e0

Please sign in to comment.