Fix self-node snapping on node addition

This commit is contained in:
Jack Kingsman
2026-03-13 10:42:36 -07:00
parent 96d8d1dc64
commit 70d28e53a9
2 changed files with 31 additions and 0 deletions
@@ -123,6 +123,31 @@ afterEach(() => {
});
describe('useVisualizerData3D', () => {
it('hard-pins the self node at the origin', async () => {
const selfKey = 'ffffffffffff0000000000000000000000000000000000000000000000000000';
const { result } = renderVisualizerData({
packets: [],
contacts: [],
config: createConfig(selfKey),
});
await waitFor(() => expect(result.current.nodes.get('self')).toBeDefined());
const selfNode = result.current.nodes.get('self');
expect(selfNode).toMatchObject({
x: 0,
y: 0,
z: 0,
fx: 0,
fy: 0,
fz: 0,
vx: 0,
vy: 0,
vz: 0,
});
});
it('keeps canonical adjacency stable when ambiguous repeaters are shown or hidden', async () => {
const selfKey = 'ffffffffffff0000000000000000000000000000000000000000000000000000';
const aliceKey = 'aaaaaaaaaaaa0000000000000000000000000000000000000000000000000000';