Skip to content

Commit

Permalink
test: enhance useThree hook test for accurate size property checking
Browse files Browse the repository at this point in the history
Updated the test for the useThree hook to accurately check the size property. The test now uses specific dimensions (width: 1280, height: 800) to create the component, ensuring that the size object is correctly tested against expected values. This change improves the test's effectiveness in catching potential size-related issues in the configure function.

Related to pmndrs#3133
  • Loading branch information
AbsharHassan committed Jan 2, 2024
1 parent a571f5c commit f950fe1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/test-renderer/src/__tests__/RTTR.hooks.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ describe('ReactThreeTestRenderer Hooks', () => {
return <group />
}

await ReactThreeTestRenderer.create(<Component />)
await ReactThreeTestRenderer.create(<Component />, { width: 1280, height: 800 })

expect(result.camera instanceof THREE.Camera).toBeTruthy()
expect(result.scene instanceof THREE.Scene).toBeTruthy()
expect(result.raycaster instanceof THREE.Raycaster).toBeTruthy()
expect(result.size).toEqual({ height: 0, width: 0, top: 0, left: 0, updateStyle: false })
expect(result.size).toEqual({ height: 800, width: 1280, top: 0, left: 0, updateStyle: true })
})

it('can handle useLoader hook', async () => {
Expand Down

0 comments on commit f950fe1

Please sign in to comment.