From 127cbb778ceba7d90848b6d2b7cf63e86a232e05 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philippe=20Rivi=C3=A8re?= Date: Sat, 15 Aug 2020 13:30:10 +0200 Subject: [PATCH] test that forceCollide jiggles in a reproducible way --- test/collide-test.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/test/collide-test.js b/test/collide-test.js index f9ed20f..e9529d6 100644 --- a/test/collide-test.js +++ b/test/collide-test.js @@ -46,3 +46,12 @@ tape("forceCollide jiggles equal positions", function(test) { test.equal(a.vy, -b.vy); test.end(); }); + +tape("forceCollide jiggles in a reproducible way", function(test) { + const nodes = Array.from({length:10}, () => ({x:0,y:0})); + force.forceSimulation() + .nodes(nodes) + .force("collide", force.forceCollide()).stop().tick(50); + test.nodeEqual(nodes[0], {x: -5.371433857229194, y: -2.6644608278592576, index: 0, vy: 0, vx: 0}); + test.end(); +});