refactor(ui): inline the one-team check for the Spend Per Tag card

singleTeamId had one caller and its unit test repeated what EntityUsage.test.tsx already checks through the page, so the module and its test are removed.
This commit is contained in:
Mrinal Chanshetty 2026-10-24 20:38:12 -05:00
parent 9b986fb517
commit 64a186594d
3 changed files with 1 additions and 15 deletions

View file

@ -55,7 +55,6 @@ import { Panel, Segmented, Sparkline, Stat } from "../overview/Primitives";
import TopModelView from "./TopModelView";
import TeamTagSpendCard from "./TeamTagSpendCard";
import TeamUserSpendCard from "./TeamUserSpendCard";
import { singleTeamId } from "./teamTagSpend";
import { ProviderSpendBreakdown } from "./SpendByProvider";
const BRAND = "#2b3fd6";
@ -363,7 +362,7 @@ const EntityUsage: React.FC<EntityUsageProps> = ({
const filterSlot = entityFilterSlots[entityType];
const capitalizedEntityLabel = entityType.charAt(0).toUpperCase() + entityType.slice(1);
const tagSpendTeamId = entityType === "team" ? singleTeamId(selectedTags) : null;
const tagSpendTeamId = entityType === "team" && selectedTags.length === 1 ? selectedTags[0] : null;
const showFlatCost = entityType === "team" && hasFlatCost(spendData.metadata);
const showPtuHours = entityType === "team" && hasPtuHours(spendData.metadata);
const userSpendTeamIds = useMemo(

View file

@ -1,11 +0,0 @@
import { describe, expect, it } from "vitest";
import { singleTeamId } from "./teamTagSpend";
describe("singleTeamId", () => {
it("is the team only when exactly one is selected", () => {
expect(singleTeamId(["team-a"])).toBe("team-a");
expect(singleTeamId([])).toBeNull();
expect(singleTeamId(["team-a", "team-b"])).toBeNull();
});
});

View file

@ -1,2 +0,0 @@
export const singleTeamId = (selectedTeamIds: readonly string[]): string | null =>
selectedTeamIds.length === 1 ? selectedTeamIds[0] : null;