import { describe, it, expect, vi } from "vitest";
import { getAppSettings } from "./appSettings.js";
import type { ApiClient } from "./client.js";

describe("getAppSettings", () => {
  it("calls /appSettings endpoint", async () => {
    const mockResponse = {
      uiOptions: {
        filter: {
          onlineboard: { searchFrom: "2d", searchTo: "14d" },
          schedule: { searchFrom: "30d", searchTo: "30d" },
        },
      },
    };
    const client = {
      get: vi.fn().mockResolvedValue(mockResponse),
    } as unknown as ApiClient;

    const result = await getAppSettings(client);

    expect(client.get).toHaveBeenCalledWith("/appSettings");
    expect(result).toEqual(mockResponse);
  });
});
