Need help with Feature TDD and Socialite/Passport API Authentication
I am trying to do some TDD with API Authentication using Socialite & Passport. I realize that these are formal 3rd party packages that are fully tested already. I understand that and am fine with Mocks and Test Doubles where needed. I want to make sure I have fully tested the proper data flow within my application.
I am having troubles wrapping my head around what I should setup and mock in my test to represent the API endpoints and responses that are needed.
Consider the following tests:
it_can_register_using_google
it_can_authenticate_using_toogle
it_can_refresh_using google
These tests need to handle the endpoints for getting both Access and Authentication tokens. Then go through the logic of either Finding/Creating the user and refreshing with a token at the appropriate point.
I am wondering if anyone has some sample tests showing what elements need to be mocked and the proper order along with the appropriate routes.
I have seen the https://github.com/coderello/laravel-passport-social-grant repo and have reviewed his tests, but frankly they are confusing to me and don't represent testing it from a feature perspective using routes etc.
Does anyone have suggestions? FYI, I want to set this test up from the Backend/API Server itself, not from the client (Vue/Mobile etc).
Please or to participate in this conversation.