Skip to content

Commit 942f749

Browse files
committed
fix: update jest test to reflect GetActor invoke rather than getActor prop read
1 parent b63e9ad commit 942f749

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

‎src/ansys/visor/visor-client/src/jest-tests/VtkSceneMouse.test.js‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@ import VtkScene from '../wasm/VtkScene.js';
99
*
1010
* The scene is built over a fake remote scene: its canvas sits inside its
1111
* canvas div, and its renderer, camera, interactor and picker are doubles.
12-
* The picker reports actor 7 for any pick. `requestAnimationFrame` does
12+
* The picker reports actor 7 for any pick through an invoked `GetActor()`.
13+
* Its `getActor` property read fetches and registers the actor wrapper, creating
14+
* a new wasm id that can clash with the server's. `requestAnimationFrame` does
1315
* nothing, so the frame-rate monitor never runs.
1416
*
1517
* Expected values are hand-written literals.
@@ -46,7 +48,10 @@ async function makeScene() {
4648
y: 0,
4749
});
4850
const camera = { observe: () => undefined };
49-
const picker = { Pick: async () => true, getActor: async () => ({ id: 7 }) };
51+
const picker = {
52+
Pick: async () => true,
53+
GetActor: jest.fn(async () => ({ id: 7 })),
54+
};
5055
const interactor = { GetPicker: async () => picker, GetEventPosition: async () => [20, 70] };
5156
const remoteVtkScene = {
5257
renderer: { GetActiveCamera: async () => camera },
@@ -55,7 +60,7 @@ async function makeScene() {
5560
canvas,
5661
};
5762
scene = await VtkScene.getInstanceAsync(null, remoteVtkScene);
58-
return { scene, canvas };
63+
return { scene, canvas, picker };
5964
}
6065

6166
/** Dispatch a bubbling mouse event of type with DOM button on target at client (clientX, clientY). */

0 commit comments

Comments
 (0)