import { describe, expect, test } from "vitest";
import { dimensionLabDashboardFixture } from "$lib/dashboard-seed/dimensionlab";
import { loadDashboardResponse } from "./dashboard";

describe("dashboard API route", () => {
  test("returns ready dashboard runtime state from the existing model loader", async () => {
    const response = await loadDashboardResponse({
      disableLiveDatasources: true,
      refreshSeedDocument: true,
      seedIfEmpty: true,
    });

    expect(response.state).toBe("ready");
    if (response.state !== "ready") throw new Error("expected ready dashboard");
    expect(response.document.metadata.title).toBe(
      dimensionLabDashboardFixture.metadata.title,
    );
  });
});
