: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
fix(insights): stabilize flaky legend isolate test (#90867)
posthog[bot]3c7985798007
diff --git a/products/product_analytics/frontend/insights/trends/shared/useInsightsLegendConfig.test.tsx b/products/product_analytics/frontend/insights/trends/shared/useInsightsLegendConfig.test.tsxindex 744b26585469..633afe2c232f 100644--- a/products/product_analytics/frontend/insights/trends/shared/useInsightsLegendConfig.test.tsx+++ b/products/product_analytics/frontend/insights/trends/shared/useInsightsLegendConfig.test.tsx@@ -1,5 +1,6 @@-import { renderHook, waitFor } from '@testing-library/react'+import { renderHook } from '@testing-library/react'import { BindLogic } from 'kea'+import { expectLogic } from 'kea-test-utils'import { featureFlagLogic } from 'lib/logic/featureFlagLogic'import { insightDataLogic } from 'scenes/insights/insightDataLogic'@@ -92,14 +93,15 @@ describe('useInsightsLegendConfig', () => {setup({ trendsFilter: { showLegend: true }, results: SERIES })const { result } = renderHook(() => useInsightsLegendConfig({ insightProps }), { wrapper })const logic = trendsDataLogic(insightProps)+ const persistenceLogic = insightVizDataLogic(insightProps)const [first, second] = logic.values.indexedResults- result.current.onSetHiddenSeries!([String(second.id)])+ await expectLogic(persistenceLogic, () => {+ result.current.onSetHiddenSeries!([String(second.id)])+ }).toFinishListeners()- await waitFor(() => {- const { getTrendsHidden } = logic.values- expect([getTrendsHidden(first), getTrendsHidden(second)]).toEqual([false, true])- })+ const { getTrendsHidden } = logic.values+ expect([getTrendsHidden(first), getTrendsHidden(second)]).toEqual([false, true])})it('groups a compared series two rows onto one visibility key', () => {