How to mock Nuxt composition API

Viewed 142

I'm using the nuxt-composition-api and I would like to mock the useAsync function in jest. But I'm rather new to jest and can't find any examples on how to mock composition functions. In my special case I am using useAsync to load content from Contentful:

const textEntry = useAsync(() =>
    client.getEntry<IText>(entryId)
);

So the mock should basically return and resolve a Promise<Entry<IText>>. I have test helpers to create the Entry<IText> part.

0 Answers
Related