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>
21 lines
945 B
TypeScript
21 lines
945 B
TypeScript
import { render, screen } from "@testing-library/react";
|
|
import { describe, expect, it } from "vitest";
|
|
import { LicenceDelivery } from "./LicenceDelivery";
|
|
|
|
describe("LicenceDelivery", () => {
|
|
it("offers the file and always shows the blob as a fallback", () => {
|
|
render(
|
|
<LicenceDelivery
|
|
instanceId="6a0fe3f0-49d2-4aa1-967c-a3094b200b5d"
|
|
blob="VANTAGE-LIC abc123"
|
|
downloadUrl="https://admin.example.com/api/instances/x/license/download"
|
|
/>,
|
|
);
|
|
const link = screen.getByRole("link", { name: /download licence/i });
|
|
expect(link).toHaveAttribute("href", expect.stringContaining("/license/download"));
|
|
// A blocked download must never leave a paying customer stuck.
|
|
expect(screen.getByText(/VANTAGE-LIC abc123/)).toBeInTheDocument();
|
|
expect(screen.getByText(/Settings → Licence/)).toBeInTheDocument();
|
|
});
|
|
});
|