Skip to content

Commit

Permalink
RTTR: prevent warn log in test
Browse files Browse the repository at this point in the history
  • Loading branch information
satelllte committed Jan 24, 2024
1 parent 4202776 commit 14f10bc
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions packages/test-renderer/src/__tests__/RTTR.events.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ describe('ReactThreeTestRenderer Events', () => {
it('should not throw if the handle name is incorrect', async () => {
const handlePointerDown = jest.fn()

const consoleWarnSpy = jest.spyOn(console, 'warn').mockImplementationOnce(jest.fn())

const Component = () => {
return (
<mesh onPointerDown={handlePointerDown}>
Expand All @@ -53,5 +55,10 @@ describe('ReactThreeTestRenderer Events', () => {
expect(async () => await fireEvent(scene.children[0], 'onPointerUp')).not.toThrow()

expect(handlePointerDown).not.toHaveBeenCalled()

expect(consoleWarnSpy).toHaveBeenCalledTimes(1)
expect(consoleWarnSpy).toHaveBeenCalledWith(
'Handler for onPointerUp was not found. You must pass event names in camelCase or name of the handler https://github.com/pmndrs/react-three-fiber/blob/master/packages/test-renderer/markdown/rttr.md#create-fireevent',
)
})
})

0 comments on commit 14f10bc

Please sign in to comment.