Skip to content

toGraph

toGraph is a function that allows you to convert a THREE.js object into a simple NgtTestGraphObject.

This is useful for snapshot testing as it at least provides the scene graph structure.

1
const { fixture, toGraph } = NgtTestBed.create(SceneGraph);
2
fixture.detectChanges();
3
4
expect(toGraph()).toMatchSnapshot();
5
6
/**
7
* For a scene with a single mesh
8
*
9
* [
10
* {
11
* "type": "Mesh",
12
* "name": "",
13
* "children": []
14
* }
15
* ]
16
*/