test(ui): avoid adding testing-library/no-node-access in wiring test

The new UsagePageView wiring test selected the user-filter combobox by
walking the DOM, adding testing-library/no-node-access warnings that
pushed the repo-wide count past its eslint-budgets.json ceiling and
failed the "Check lint budgets" step of frontend-lint. Target the
combobox by its placeholder text (a Testing Library query) instead, so
the test adds no node access.
This commit is contained in:
Trevor Mack 2026-09-16 16:14:01 -04:00
parent c19001ce2e
commit 22d99e23e4
No known key found for this signature in database

View file

@ -1371,12 +1371,10 @@ describe("UsagePage", () => {
});
describe("selected-user budget wiring", () => {
const userSelectCombobox = (): HTMLElement => {
let node: HTMLElement | null = screen.getByText("Filter by user");
while (node && !node.querySelector('[role="combobox"]')) {
node = node.parentElement;
}
return node!.querySelector('[role="combobox"]') as HTMLElement;
const selectAlice = async () => {
const user = userEvent.setup();
await user.click(screen.getByPlaceholderText("Search users by email…"));
await user.click(await screen.findByText("Alice (user-001)"));
};
it("feeds the tile the selected user's budget and duration, not the admin's", async () => {
@ -1394,8 +1392,7 @@ describe("UsagePage", () => {
renderWithProviders(<UsagePage {...defaultProps} />);
await waitFor(() => expect(mockUserDailyActivityAggregatedCall).toHaveBeenCalled());
await userEvent.setup().click(userSelectCombobox());
await userEvent.setup().click(screen.getByText("Alice (user-001)"));
await selectAlice();
await waitFor(() => {
expect(screen.getByTestId("view-user-spend")).toHaveAttribute("data-max-budget", "600");
@ -1415,8 +1412,7 @@ describe("UsagePage", () => {
renderWithProviders(<UsagePage {...defaultProps} />);
await waitFor(() => expect(mockUserDailyActivityAggregatedCall).toHaveBeenCalled());
await userEvent.setup().click(userSelectCombobox());
await userEvent.setup().click(screen.getByText("Alice (user-001)"));
await selectAlice();
await waitFor(() => {
expect(screen.getByTestId("view-user-spend")).toHaveAttribute("data-budget-loading", "true");