18 lines
898 B
JavaScript

import { render, screen } from "@testing-library/react";
import { expect, test, vi } from "vitest";
import { ExternalI18nProvider } from "../i18n/ExternalI18nProvider.jsx";
import { ResourceGrantDialog } from "./GrantDialogs.jsx";
test("shows only actionable grant fields without a descriptive notice", () => {
render(
<ExternalI18nProvider>
<ResourceGrantDialog loading={false} onClose={vi.fn()} onSubmit={vi.fn()} open resources={[]} />
</ExternalI18nProvider>
);
expect(screen.getByRole("dialog", { name: "Grant privilege item" })).toBeInTheDocument();
expect(screen.queryByRole("alert")).not.toBeInTheDocument();
expect(screen.queryByText("Before submission, the user is verified in the current App and the server-returned user ID is used for the grant.")).not.toBeInTheDocument();
expect(screen.getByText("Enter 0 for permanent validity")).toBeInTheDocument();
});