Skip to content

How to test runOnJs executed functions? #6377

Answered by Latropos
Glazzes asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @Glazzes ! could you test the callbacks with some additional shared Value? These values are accessible from both JS and UI threads so you could use them like that:

test("do something", () => {
  const someSharedValue = makeMutable(false)
  const onPanEnd = ()=>{'worklet'; someSharedValue.value = true;}
  
  // ... render component and fire the gestue

  expect(someSharedValue.value).toBeTruthy();
});

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Glazzes
Comment options

Answer selected by Latropos
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants