diff --git a/src/components/VersionedLink/VersionedLink.test.tsx b/src/components/VersionedLink/VersionedLink.test.tsx
index 61b824cd5b..3fcd0500e9 100644
--- a/src/components/VersionedLink/VersionedLink.test.tsx
+++ b/src/components/VersionedLink/VersionedLink.test.tsx
@@ -20,6 +20,19 @@ describe("Versioned link", () => {
expect(link).toBe(url);
});
+ it("latest version with component", () => {
+ prevVersionPath = "";
+ const componentText = "Component text";
+ const component =
{componentText}
;
+ const url = "/path/url";
+ render();
+ const componentRender = screen.getByText(componentText);
+ expect(componentRender).not.toBeNull();
+ const link = screen.getByRole("link").getAttribute("href");
+ expect(link).not.toBeNull();
+ expect(link).toBe(url);
+ });
+
it("previous version", () => {
prevVersionPath = "/v4.3.1";
const text = "Test link";
@@ -30,6 +43,19 @@ describe("Versioned link", () => {
expect(link).toBe(prevVersionPath.concat(url));
});
+ it("previous version with component", () => {
+ prevVersionPath = "/v4.3.1";
+ const componentText = "Component text";
+ const component = {componentText}
;
+ const url = "/path/url";
+ render();
+ const componentRender = screen.getByText(componentText);
+ expect(componentRender).not.toBeNull();
+ const link = screen.getByRole("link").getAttribute("href");
+ expect(link).not.toBeNull();
+ expect(link).toBe(prevVersionPath.concat(url));
+ });
+
it("url with back dots", () => {
prevVersionPath = "";
const text = "Test link";