import { beforeEach, describe, expect, it } from "vitest";
import { useAiAgentUiStore } from "./ai-agent-ui";

describe("useAiAgentUiStore", () => {
  beforeEach(() => {
    useAiAgentUiStore.setState({
      documentAgentAvailable: false,
      documentAgentOpen: false,
      documentAgentActivated: false,
      globalAgentOpen: false,
      globalAgentActivated: false,
    });
  });

  it("全局 AI 开关不依赖页面 AI 可用态", () => {
    const state = useAiAgentUiStore.getState();

    state.toggleGlobalAgentOpen();
    expect(useAiAgentUiStore.getState().globalAgentOpen).toBe(true);
    expect(useAiAgentUiStore.getState().globalAgentActivated).toBe(true);

    state.toggleGlobalAgentOpen();
    expect(useAiAgentUiStore.getState().globalAgentOpen).toBe(false);
    expect(useAiAgentUiStore.getState().globalAgentActivated).toBe(true);
  });
});
