Happening now | Office Hours: Customizing Your Theme With Moeed | Ask your questions now!

How can I mock the App Bridge Provider for unit testing a React frontend app?

How can I mock the App Bridge Provider for unit testing a React frontend app?

MalekMohamed
Shopify Partner
1 0 2

 Hey everyone, I am facing a difficulty regards unit testing my Shopify app which built in PHP (Backend) and React (Frontend).
When ever i try to do a test case for a component which using "useAuthenticatedFetch"

hook i keep getting "No AppBridge context provided. Your component must be wrapped in the <Provider> component from App Bridge React" and when ever i try to wrap the component with the App Bridge Provider it doesn`t work since its require few params (Host, ShopifyApiKey).
So my Question is how i can mock the App Bridge Provider the required params?

Thanks for your time.

Replies 0 (0)