: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 { fireEvent, render } from '@testing-library/react'
import { HogFunctionIcon } from './HogFunctionIcon'
jest.mock('react-intersection-observer', () => ({ useInView: () => ({ ref: jest.fn(), inView: true }) }))
describe('HogFunctionIcon', () => {
it('shows the fallback hedgehog instead of a loading skeleton when the image fails to load', () => {
const { container, getByText } = render(<HogFunctionIcon src="/static/services/missing.png" />)
fireEvent.error(container.querySelector('img')!)
expect(container.querySelector('img')).toBeNull()
expect(container.querySelector('.LemonSkeleton')).toBeNull()
getByText('🦔')
})
})