mirror of
https://github.com/BerriAI/litellm.git
synced 2026-10-09 03:18:44 +00:00
feat: extract OnboardingErrorView component with tests
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
a3d4a8752f
commit
a347cf0a33
2 changed files with 43 additions and 0 deletions
|
|
@ -0,0 +1,25 @@
|
|||
import React from "react";
|
||||
import { render, screen } from "@testing-library/react";
|
||||
import { describe, it, expect } from "vitest";
|
||||
import { OnboardingErrorView } from "./OnboardingErrorView";
|
||||
|
||||
describe("OnboardingErrorView", () => {
|
||||
it("shows the failed to load invitation message", () => {
|
||||
render(<OnboardingErrorView />);
|
||||
expect(screen.getByText("Failed to load invitation")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("shows the expiry description", () => {
|
||||
render(<OnboardingErrorView />);
|
||||
expect(
|
||||
screen.getByText("The invitation link may be invalid or expired.")
|
||||
).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("renders a Back to Login link pointing to /ui/login", () => {
|
||||
render(<OnboardingErrorView />);
|
||||
// antd Button with href renders as an <a> element
|
||||
const link = screen.getByRole("link", { name: "Back to Login" });
|
||||
expect(link).toHaveAttribute("href", "/ui/login");
|
||||
});
|
||||
});
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
import React from "react";
|
||||
import { Alert, Button } from "antd";
|
||||
|
||||
export function OnboardingErrorView() {
|
||||
return (
|
||||
<div className="mx-auto w-full max-w-md mt-10">
|
||||
<Alert
|
||||
type="error"
|
||||
message="Failed to load invitation"
|
||||
description="The invitation link may be invalid or expired."
|
||||
showIcon
|
||||
/>
|
||||
<div className="mt-4">
|
||||
<Button href="/ui/login">Back to Login</Button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Reference in a new issue