Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit testing - gltfjsx created components #259

Open
Marlinxx opened this issue May 9, 2024 · 0 comments
Open

Unit testing - gltfjsx created components #259

Marlinxx opened this issue May 9, 2024 · 0 comments

Comments

@Marlinxx
Copy link

Marlinxx commented May 9, 2024

I create the react components form .glb files using gltfjsx package. And I make some changes like adding event handlers and adding refs.
The React component works fine in dev environment. But cannot render the component from unit testing.

Test case:

test("render" , async () => {
  const mechClickHandler = jest.fn();

  const props = {
        position: new Vector3(0, 0, 0),
        slotNumber: 1,
        cardName: "HCPSLine22",
        onMeshClick: mechClickHandler,
        ports: cardData.ports,
        cardType: "HCPSLine22",
        card: cardData,
        expanded: false,
        ejected: false,
      };
  render(<HCPSLine22 {...props} />)
}) 

And Im facing below issue,
TypeError: Cannot destructure property 'nodes' of '(0 , _drei.useGLTF)(...)' as it is undefined.

Aim: I looking to test the events fired from component

Can someone help here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant