Skip to content

Commit

Permalink
Fix test since now we have more than 1 mesh
Browse files Browse the repository at this point in the history
Signed-off-by: Aaron Chong <[email protected]>
  • Loading branch information
aaronchongth committed Nov 24, 2023
1 parent 8277b4d commit 10878b2
Showing 1 changed file with 31 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import React from 'react';
import { RobotThreeMaker } from './robot-three-maker';
import { RobotData, RobotThreeMaker } from './robot-three-maker';
import { Euler, Vector3 } from 'three';
import ReactThreeTestRenderer from '@react-three/test-renderer';

describe('RobotThreeMaker', () => {
it('renders color properly', async () => {
const robot = {
it('renders robot properly', async () => {
const robot: RobotData = {
fleet: 'Fleet 1',
name: 'Robot 1',
model: 'Model 1',
footprint: 1.0,
color: 'blue',
scale: 1.0,
};

const renderer = await ReactThreeTestRenderer.create(
Expand All @@ -19,11 +20,37 @@ describe('RobotThreeMaker', () => {
position={new Vector3(0, 0, 0)}
rotation={new Euler(0, 0, 0)}
circleSegment={64}
robotLabel={true}
/>,
);

const mesh = renderer.scene.children[0].allChildren;

expect(mesh.length).toBe(1);
expect(mesh.length).toBe(3);
});

it('renders robot without label', async () => {
const robot: RobotData = {
fleet: 'Fleet 1',
name: 'Robot 1',
model: 'Model 1',
footprint: 1.0,
color: 'blue',
scale: 1.0,
};

const renderer = await ReactThreeTestRenderer.create(
<RobotThreeMaker
robot={robot}
position={new Vector3(0, 0, 0)}
rotation={new Euler(0, 0, 0)}
circleSegment={64}
robotLabel={false}
/>,
);

const mesh = renderer.scene.children[0].allChildren;

expect(mesh.length).toBe(2);
});
});

0 comments on commit 10878b2

Please sign in to comment.