require("babel-plugin-require-context-hook/register")();

// styled-components warns when a component is first imported during a React render.
// In tests, modules are loaded lazily (on first use), so they get evaluated inside
// a render cycle — a false positive. The components themselves are correctly defined
// at module level; this suppressor avoids ~1800 spurious warnings per test run.
const originalWarn = console.warn.bind(console);
console.warn = (...args) => {
	if (typeof args[0] === "string" && args[0].includes("has been created dynamically")) return;
	originalWarn(...args);
};

module.exports = () => {
	global.IS_REACT_ACT_ENVIRONMENT = true;
};

window.matchMedia =
	window.matchMedia ||
	(() => ({
		matches: false,
		addListener: function () {},
		removeListener: function () {},
	}));

class ResizeObserverMock {
	observe() {}
	unobserve() {}
	disconnect() {}
}

global.ResizeObserver = ResizeObserverMock;
