Database governance built for humans and agents — controlling changes and access across every major database.
Go cicddata-governancedata-maskingdata-securitydatabase-accessdatabase-governancedevopsdevsecopsflywaygitopsliquibasemongodbmysqloraclepostgresqlschema-migrationssecuritysql-clientsqlservertidb
import { render, screen } from "@testing-library/react";
import { describe, expect, test, vi } from "vitest";
import { AccountTypeBadge } from "./AccountTypeBadge";
vi.mock("react-i18next", async (importOriginal) => ({
...(await importOriginal<typeof import("react-i18next")>()),
useTranslation: () => ({ t: (key: string) => key }),
}));
describe("AccountTypeBadge", () => {
test("marks nothing for a person", () => {
const { container } = render(<AccountTypeBadge email="[email protected]" />);
expect(container).toBeEmptyDOMElement();
});
test.each([
["[email protected]", "settings.members.service-account"],
["[email protected]", "settings.members.workload-identity"],
])("names the account type of %s", (email, label) => {
render(<AccountTypeBadge email={email} />);
expect(screen.getByText(label)).toBeInTheDocument();
});
// The name beside it identifies the principal; the mark is secondary
// metadata, and accent is reserved for primary action and selected state.
test.each([
false,
true,
])("never draws the mark in the accent role (compact: %s)", (compact) => {
render(
<AccountTypeBadge compact={compact} email="[email protected]" />
);
expect(
screen.getByText("settings.members.service-account").className
).not.toMatch(/accent/);
});
});