Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

1019 B
Raw Blame
import { trackStepByStepTourEvent } from '../analytics'

const mockTrackEvent = vi.hoisted(() => vi.fn())

vi.mock('@/app/components/base/amplitude', () => ({
  trackEvent: mockTrackEvent,
}))

describe('step-by-step tour analytics', () => {
  it('tracks the unified event with scalar properties only', () => {
    trackStepByStepTourEvent({
      action: 'task_completed',
      completed_task_count: 1,
      home_outcome: 'lesson_app_created',
      permission_variant: 'full',
      task_id: 'home',
      task_total: 4,
    })

    expect(mockTrackEvent).toHaveBeenCalledWith('step_tour', {
      action: 'task_completed',
      completed_task_count: 1,
      home_outcome: 'lesson_app_created',
      permission_variant: 'full',
      task_id: 'home',
      task_total: 4,
    })
  })

  it('omits undefined optional properties', () => {
    trackStepByStepTourEvent({ action: 'tour_enabled', task_id: undefined })

    expect(mockTrackEvent).toHaveBeenCalledWith('step_tour', { action: 'tour_enabled' })
  })
})