Files
jobtrackingapp/job-tracker-ui/src/pro-feature-notice.test.tsx
T
cesnimda a25c31b93a
CI and Deploy / test (pull_request) Successful in 5m6s
CI and Deploy / deploy (pull_request) Has been skipped
feat(plans): publish honest Free and Pro
2026-08-15 18:04:18 +02:00

28 lines
1.0 KiB
TypeScript

import React from "react";
import "@testing-library/jest-dom";
import { fireEvent, render, screen } from "@testing-library/react";
import ProFeatureNotice from "./components/ProFeatureNotice";
beforeEach(() => window.sessionStorage.clear());
test("shows a respectful upgrade action and remembers dismissal for the session", () => {
const { unmount } = render(
<ProFeatureNotice featureKey="test-feature" title="Draft faster with Pro.">
Existing content stays editable.
</ProFeatureNotice>,
);
expect(screen.getByRole("link", { name: "View Pro" })).toHaveAttribute("href", "/settings");
fireEvent.click(screen.getByRole("button", { name: "Dismiss Draft faster with Pro." }));
expect(screen.queryByText("Draft faster with Pro.")).not.toBeInTheDocument();
unmount();
render(
<ProFeatureNotice featureKey="test-feature" title="Draft faster with Pro.">
Existing content stays editable.
</ProFeatureNotice>,
);
expect(screen.queryByText("Draft faster with Pro.")).not.toBeInTheDocument();
});