:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
import '@testing-library/jest-dom'
import { cleanup, render } from '@testing-library/react'
import { SurveyDragHandle } from './SurveyDragHandle'
describe('SurveyDragHandle', () => {
beforeEach(() => {
cleanup()
})
const mockListeners = {
onKeyDown: jest.fn(),
onMouseDown: jest.fn(),
}
it('renders drag handle for draft surveys with multiple questions', () => {
const { getByTestId } = render(<SurveyDragHandle hasMultipleQuestions={true} listeners={mockListeners} />)
expect(getByTestId('survey-question-drag-handle')).toBeInTheDocument()
})
it('does not render for surveys with only one question', () => {
const { queryByTestId } = render(<SurveyDragHandle hasMultipleQuestions={false} listeners={mockListeners} />)
expect(queryByTestId('survey-question-drag-handle')).not.toBeInTheDocument()
})
})