How to use the d3-force.forceSimulation.mockImplementation function in d3-force

To help you get started, we’ve selected a few d3-force examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github danielcaldas / react-d3-graph / test / graph / graph.helper.spec.js View on Github external
beforeEach(() => {
                const fr = 10;
                const forceStub = jest.fn();

                d3ForceX.mockImplementation(() => ({ strength: () => fr }));
                d3ForceY.mockImplementation(() => ({ strength: () => fr }));
                d3ForceManyBody.mockImplementation(() => ({ strength: () => fr }));
                forceStub.mockImplementation(() => ({ force: forceStub }));
                d3ForceSimulation.mockImplementation(() => ({ force: forceStub }));
                utils.merge.mockImplementation(() => ({ config: "config" }));
            });