: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 { PipelineResultType } from '~/ingestion/framework/results'
import { prefetchEventSchemasStep } from '~/ingestion/pipelines/analytics/steps/prefetchEventSchemasStep'
type TestInput = { team: { id: number } }
function createInput(teamId: number): TestInput {
return { team: { id: teamId } }
}
describe('prefetchEventSchemasStep', () => {
it('warms the schema cache by team id', async () => {
const manager = { getSchemasForTeams: jest.fn().mockResolvedValue({}) }
const step = prefetchEventSchemasStep<TestInput>(manager, true)
const results = await step([createInput(3), createInput(4)])
expect(results.map((result) => result.type)).toEqual(Array(2).fill(PipelineResultType.OK))
expect(manager.getSchemasForTeams).toHaveBeenCalledWith([3, 4], { flush: true })
})
})