DEV Community

Omar White
Omar White

Posted on

How do you test code that uses browser api's?

I've been working with the Web Payment Request API recently and have found that its kind of a pain to test my code. The solution i've come to is writing wrapper functions for the browser API calls and mocking those in my tests. This allows me to isolate the browser API code and test around it, but i'm wondering if there is a better way. I would appreciate any insights.

Top comments (0)