The easy-to-use open source Business Intelligence and Embedded Analytics tool that lets everyone work with data :bar_chart:
TypeScript analyticsbibusiness-intelligencebusinessintelligenceclojuredashboarddatadata-analysisdata-visualizationdatabasemetabasemysqlpostgrespostgresqlreportingslacksql-editorvisualization
Resolve the mocked floating-ui position synchronously (#83064)
Romeo Van Snick3786e73df0a8
diff --git a/frontend/test/jest-setup-env.js b/frontend/test/jest-setup-env.jsindex 0f23b20d42d..3410d3f5133 100644--- a/frontend/test/jest-setup-env.js+++ b/frontend/test/jest-setup-env.js@@ -6,14 +6,19 @@ import fetchMock from "fetch-mock";// costing getComputedStyle calls and an extra re-render per position update.jest.mock("@floating-ui/dom", () => ({...jest.requireActual("@floating-ui/dom"),- computePosition: (_reference, _floating, options = {}) =>- Promise.resolve({- x: 0,- y: 0,- placement: options.placement ?? "bottom",- strategy: options.strategy ?? "absolute",- middlewareData: {},- }),+ // Resolving synchronously keeps the position update inside the act() scope of+ // the render that asked for it. A resolved promise defers it by a microtask,+ // which can land after the test ends and makes React log an act() warning.+ computePosition: (_reference, _floating, options = {}) => ({+ then: (onFulfilled) =>+ onFulfilled({+ x: 0,+ y: 0,+ placement: options.placement ?? "bottom",+ strategy: options.strategy ?? "absolute",+ middlewareData: {},+ }),+ }),autoUpdate: (_reference, _floating, update) => {update();return () => {};