: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 { apiMutator } from 'lib/api-orval-mutator'
import { useMocks } from '~/mocks/jest'
describe('apiMutator', () => {
it('returns the parsed body of a delete that answers with one', async () => {
useMocks({ delete: { '/api/projects/:team_id/probe/:id/': { status: 'cancelled', report_id: 7 } } })
const result = await apiMutator('/api/projects/1/probe/2/', { method: 'DELETE' })
expect(result).toEqual({ status: 'cancelled', report_id: 7 })
})
it('returns null for a delete with no content', async () => {
useMocks({ delete: { '/api/projects/:team_id/probe/:id/': () => [204] } })
const result = await apiMutator('/api/projects/1/probe/2/', { method: 'DELETE' })
expect(result).toBeNull()
})
})