import { mount } from '@vue/test-utils';
import { h } from 'vue';

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

import ChatTimeline from '../ChatTimeline.vue';

describe('chat timeline custom item', () => {
  it('renders business content through the custom item slot', () => {
    const wrapper = mount(ChatTimeline, {
      props: {
        items: [
          {
            customType: 'workflow-final-output',
            data: { answer: '完成' },
            id: 'final-result',
            type: 'custom',
          },
        ],
      },
      slots: {
        'custom-item': ({ item }: any) =>
          h('div', { class: 'custom-result' }, item.customType),
      },
    });

    expect(wrapper.get('.custom-result').text()).toBe('workflow-final-output');
  });
});
