import { describe, expect, it } from "vitest";
import {
  i1FactoryRuns,
  i1Goals,
  i1Ids,
  i1Plans,
  i1Project,
  i1Tasks,
  projectOverviewReadModel,
} from "@awp/application";
describe("deterministic I1 UI contract", () => {
  it("builds stable project overview without provider-native state", () => {
    const view = projectOverviewReadModel({
      project: i1Project,
      goals: i1Goals,
      plans: i1Plans,
      planGoalIds: new Map([[i1Ids.plan, [i1Ids.goal]]]),
      tasks: i1Tasks,
      queueOrder: [i1Ids.taskFoundation, i1Ids.taskUi],
      factoryRuns: i1FactoryRuns,
    });
    expect(view.project.name).toBe("AWP dogfood");
    expect(view.queue[1]).toMatchObject({
      taskId: i1Ids.taskUi,
      readinessState: "READY",
      unsatisfiedDependencyIds: [],
    });
    expect(view.plans[0]?.goalIds).toEqual([i1Ids.goal]);
  });
});
