diff --git a/ui/litellm-dashboard/src/components/OldTeams.test.tsx b/ui/litellm-dashboard/src/components/OldTeams.test.tsx index 7447432b876..584222c3ae5 100644 --- a/ui/litellm-dashboard/src/components/OldTeams.test.tsx +++ b/ui/litellm-dashboard/src/components/OldTeams.test.tsx @@ -1106,3 +1106,65 @@ describe("OldTeams - Resources column keys badge", () => { expect(cyanTag?.textContent).toContain("2"); }); }); + +describe("OldTeams - delete team warning copy", () => { + beforeEach(() => { + vi.clearAllMocks(); + mockUseOrganizations.mockReturnValue({ data: [] }); + }); + + const openDeleteModal = async (team: any) => { + renderWithQueryClient( + , + ); + await waitFor(() => { + expect(screen.getByTestId("delete-team-button")).toBeInTheDocument(); + }); + act(() => { + fireEvent.click(screen.getByTestId("delete-team-button")); + }); + expect(screen.getByText("Delete Team?")).toBeInTheDocument(); + }; + + const baseTeam = { + team_id: "1", + team_alias: "Test Team", + organization_id: "org-123", + models: ["gpt-4"], + max_budget: 100, + budget_duration: "1d", + tpm_limit: 1000, + rpm_limit: 1000, + created_at: new Date().toISOString(), + members_with_roles: [], + spend: 0, + }; + + it("warns that the team's models are deleted when the team has keys", async () => { + await openDeleteModal({ ...baseTeam, keys: [], keys_count: 2 }); + + expect(screen.getByText(/Warning: This team has 2 keys associated with it/i)).toHaveTextContent( + /along with any models created for this team/i, + ); + expect(screen.getByText(/Are you sure you want to delete this team/i)).toHaveTextContent( + /any models created for it/i, + ); + }); + + it("still warns about model deletion in the confirmation message when the team has no keys", async () => { + await openDeleteModal({ ...baseTeam, keys: [], keys_count: 0 }); + + expect(screen.queryByText(/Warning: This team has/i)).not.toBeInTheDocument(); + expect(screen.getByText(/Are you sure you want to delete this team/i)).toHaveTextContent( + /any models created for it/i, + ); + }); +}); diff --git a/ui/litellm-dashboard/src/components/OldTeams.tsx b/ui/litellm-dashboard/src/components/OldTeams.tsx index 4d045780c30..8ec97f1a206 100644 --- a/ui/litellm-dashboard/src/components/OldTeams.tsx +++ b/ui/litellm-dashboard/src/components/OldTeams.tsx @@ -979,9 +979,9 @@ const Teams: React.FC = ({ const deleteKeyCount = teamToDelete?.keys_count ?? teamToDelete?.keys?.length ?? 0; return deleteKeyCount === 0 ? undefined - : `Warning: This team has ${deleteKeyCount} keys associated with it. Deleting the team will also delete all associated keys. This action is irreversible.`; + : `Warning: This team has ${deleteKeyCount} keys associated with it. Deleting the team will also delete all associated keys, along with any models created for this team. This action is irreversible.`; })()} - message="Are you sure you want to delete this team and all its keys? This action cannot be undone." + message="Are you sure you want to delete this team, all its keys, and any models created for it? This action cannot be undone." resourceInformationTitle="Team Information" resourceInformation={[ { label: "Team ID", value: teamToDelete?.team_id, code: true },