Testing URL redirect with jest

Viewed 137

I'm trying to build a wrapper for the Spotify API, and I want to use jest to write a test for the authorization methods.

There are four four methods of authorization. Three of them send the user to a Spotify URL, ask them to authorize the app, and then redirect the user back to a provided URL. I'm using two different functions to do this: authorizeToken and getToken.

I'd like to make sure `authorizeToken is redirecting correctly and not sending the user to an error page or something. To be clear, this test would actually have to redirect to a Spotify URL and make sure it's the login page, not just an error page.

Is a test like that even possible?

0 Answers
Related