Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 10 additions & 13 deletions ui/litellm-dashboard/src/components/OldTeams.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,14 @@

vi.mock("@/components/team/TeamInfo", () => ({
__esModule: true,
default: (props: any) => {

Check warning on line 59 in ui/litellm-dashboard/src/components/OldTeams.test.tsx

View workflow job for this annotation

GitHub Actions / frontend-lint

Unexpected any. Specify a different type
mockTeamInfoView(props);
return <div data-testid="team-info-view" />;
},
}));

vi.mock("./ModelSelect/ModelSelect", () => {
const ModelSelect = React.forwardRef(({ value, onChange, dataTestId, id }: any, ref: any) => {

Check warning on line 66 in ui/litellm-dashboard/src/components/OldTeams.test.tsx

View workflow job for this annotation

GitHub Actions / frontend-lint

Unexpected any. Specify a different type

Check warning on line 66 in ui/litellm-dashboard/src/components/OldTeams.test.tsx

View workflow job for this annotation

GitHub Actions / frontend-lint

Unexpected any. Specify a different type
return (
<input
ref={ref}
Expand Down Expand Up @@ -143,7 +143,7 @@

it("should not include organization_id when it's an empty string", async () => {
const mockAccessToken = "test-token";
const formValues: Record<string, any> = {

Check warning on line 146 in ui/litellm-dashboard/src/components/OldTeams.test.tsx

View workflow job for this annotation

GitHub Actions / frontend-lint

Unexpected any. Specify a different type
team_alias: "Test Team",
organization_id: "", // Empty string
models: [],
Expand All @@ -162,7 +162,7 @@
});

it("should set organization_id to null when it's not a string type", async () => {
const formValues: Record<string, any> = {

Check warning on line 165 in ui/litellm-dashboard/src/components/OldTeams.test.tsx

View workflow job for this annotation

GitHub Actions / frontend-lint

Unexpected any. Specify a different type
team_alias: "Test Team",
organization_id: undefined,
models: [],
Expand All @@ -180,7 +180,7 @@
});

it("should trim and keep valid organization_id string", async () => {
const formValues: Record<string, any> = {

Check warning on line 183 in ui/litellm-dashboard/src/components/OldTeams.test.tsx

View workflow job for this annotation

GitHub Actions / frontend-lint

Unexpected any. Specify a different type
team_alias: "Test Team",
organization_id: " org-123 ", // String with whitespace
models: [],
Expand All @@ -198,7 +198,7 @@
});

it("should keep valid organization_id without modification", async () => {
const formValues: Record<string, any> = {

Check warning on line 201 in ui/litellm-dashboard/src/components/OldTeams.test.tsx

View workflow job for this annotation

GitHub Actions / frontend-lint

Unexpected any. Specify a different type
team_alias: "Test Team",
organization_id: "f874bb43-b898-4813-beca-4054d224eafc",
models: [],
Expand All @@ -216,7 +216,7 @@
});

it("should not send organization_id field when converting empty string to null", async () => {
const formValues: Record<string, any> = {

Check warning on line 219 in ui/litellm-dashboard/src/components/OldTeams.test.tsx

View workflow job for this annotation

GitHub Actions / frontend-lint

Unexpected any. Specify a different type
team_alias: "Test Team",
organization_id: "",
models: ["gpt-4"],
Expand Down Expand Up @@ -254,7 +254,7 @@
members: [],
};

const formValues: Record<string, any> = {

Check warning on line 257 in ui/litellm-dashboard/src/components/OldTeams.test.tsx

View workflow job for this annotation

GitHub Actions / frontend-lint

Unexpected any. Specify a different type
team_alias: "Test Team",
models: [],
};
Expand Down Expand Up @@ -283,7 +283,7 @@

// Remove organizations key if it's empty
if (Array.isArray(formValues.organizations) && formValues.organizations.length === 0) {
delete (formValues as any).organizations;

Check warning on line 286 in ui/litellm-dashboard/src/components/OldTeams.test.tsx

View workflow job for this annotation

GitHub Actions / frontend-lint

Unexpected any. Specify a different type
}

// Verify organizations key is removed
Expand Down Expand Up @@ -1046,17 +1046,14 @@
});

const openDeleteModal = async (team: any) => {
renderWithQueryClient(
<OldTeams
teams={[team]}
searchParams={{}}
accessToken="test-token"
setTeams={vi.fn()}
userID="user-123"
userRole="Admin"
organizations={[]}
/>,
);
vi.mocked(teamListCall).mockResolvedValue({
teams: [team],
total: 1,
page: 1,
page_size: 100,
total_pages: 1,
});
renderWithQueryClient(<OldTeams accessToken="test-token" userID="user-123" userRole="Admin" />);
await waitFor(() => {
expect(screen.getByTestId("delete-team-button")).toBeInTheDocument();
});
Expand All @@ -1081,9 +1078,9 @@
};

it("warns that the team's models are deleted when the team has keys", async () => {
await openDeleteModal({ ...baseTeam, keys: [], keys_count: 2 });
await openDeleteModal({ ...baseTeam, keys: [], keys_count: 5 });

expect(screen.getByText(/Warning: This team has 2 keys associated with it/i)).toHaveTextContent(
expect(screen.getByText(/Warning: This team has 5 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(
Expand Down
Loading