The blob is shown inline as well as offered as a file, because a licence is signed public data bound to one instance -- useless anywhere else -- and a blocked download must never leave a paying customer stuck. Admin now returns it to its owner for the same reason. Relink shows the remaining allowance from the backend's max_relinks rather than a hardcoded 3, and at zero it disables and says to contact support instead of failing at the API. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
18 lines
808 B
TypeScript
18 lines
808 B
TypeScript
import { render, screen } from "@testing-library/react";
|
|
import { describe, expect, it, vi } from "vitest";
|
|
import { RelinkPanel } from "./RelinkPanel";
|
|
|
|
describe("RelinkPanel", () => {
|
|
it("shows the remaining allowance", () => {
|
|
render(<RelinkPanel instanceId="i1" used={1} max={3} onRelink={vi.fn()} />);
|
|
expect(screen.getByText("2 of 3 relinks left this term")).toBeInTheDocument();
|
|
expect(screen.getByRole("button", { name: /relink/i })).toBeEnabled();
|
|
});
|
|
|
|
it("disables at zero and says what to do instead", () => {
|
|
render(<RelinkPanel instanceId="i1" used={3} max={3} onRelink={vi.fn()} />);
|
|
expect(screen.getByRole("button", { name: /relink/i })).toBeDisabled();
|
|
expect(screen.getByText(/contact support/i)).toBeInTheDocument();
|
|
});
|
|
});
|