import { describe, expect, it } from 'vitest';

import detailDrawerSource from '#/components/chat-history/ChatHistoryDetailDrawer.vue?raw';

import pageSource from './index.vue?raw';

describe('管理端智能体聊天历史契约', () => {
  it('使用智能体候选接口并保留 assistantId 查询参数', () => {
    expect(pageSource).toContain("'/api/v1/agent/list'");
    expect(pageSource).not.toContain('/api/v1/bot/list');
    expect(pageSource).toContain('label: item.name');
    expect(pageSource).toContain('assistantId: query.value.assistantId');
    expect(pageSource).not.toContain('publishedOnly');
  });

  it('统一页面和详情抽屉的智能体文案', () => {
    expect(pageSource).toContain('placeholder="筛选智能体"');
    expect(pageSource).toContain('label="智能体"');
    expect(pageSource).toContain('暂无智能体聊天记录');
    expect(pageSource).not.toContain('聊天助手');
    expect(detailDrawerSource).not.toContain('聊天助手');
  });

  it('为智能体筛选提供独立加载反馈', () => {
    expect(pageSource).toContain(':loading="agentLoading"');
    expect(pageSource).toContain('智能体列表加载失败');
  });
});
