Chore: full react hooks eslint compliance (#7040)

This commit is contained in:
shamoon
2026-08-21 14:00:02 -07:00
committed by GitHub
parent 7c26cf6d97
commit 4c361422ca
111 changed files with 1072 additions and 867 deletions
@@ -1,6 +1,6 @@
// @vitest-environment jsdom
import { render, waitFor } from "@testing-library/react";
import { render, screen, waitFor } from "@testing-library/react";
import { describe, expect, it, vi } from "vitest";
const { useWidgetAPI } = vi.hoisted(() => ({
@@ -12,6 +12,45 @@ vi.mock("utils/proxy/use-widget-api", () => ({ default: useWidgetAPI }));
import Integration from "./ical";
describe("widgets/calendar/integrations/ical", () => {
it("reports a missing calendar payload without mutating the response", () => {
const data = {};
useWidgetAPI.mockReturnValue({ data, error: undefined });
render(
<Integration
config={{ name: "Work", type: "ical" }}
params={{ start: "2099-01-01", end: "2099-01-02" }}
setEvents={vi.fn()}
hideErrors={false}
timezone="utc"
/>,
);
expect(screen.getByText(/'Work': calendar\.errorWhenLoadingData/)).toBeInTheDocument();
expect(data).toEqual({});
});
it("reports a calendar with no events without mutating the response", () => {
const data = {
data: ["BEGIN:VCALENDAR", "VERSION:2.0", "PRODID:-//Test//EN", "END:VCALENDAR", ""].join("\n"),
};
const originalData = structuredClone(data);
useWidgetAPI.mockReturnValue({ data, error: undefined });
render(
<Integration
config={{ name: "Empty", type: "ical" }}
params={{ start: "2099-01-01", end: "2099-01-02" }}
setEvents={vi.fn()}
hideErrors={false}
timezone="utc"
/>,
);
expect(screen.getByText(/'Empty': calendar\.noEventsFound/)).toBeInTheDocument();
expect(data).toEqual(originalData);
});
it("adds parsed events within the date range", async () => {
useWidgetAPI.mockReturnValue({
data: {