stacks-archive / blockstack-browser

The Blockstack Browser
Mozilla Public License 2.0
1.12k stars 199 forks source link

Technical Debt: Unit testing for Authentication Flow #1276

Open kantai opened 6 years ago

kantai commented 6 years ago

The fact that we don't have unit tests for the authentication flow is a major piece of technical debt. This makes many different pieces of the system difficult to upgrade because it is difficult to know whether or not a change is going to break auth. Even when we're careful, the fact that we're missing unit tests mean that we break the authentication flow in ways we don't intend (or don't foresee). Good unit testing should be able to catch many of these errors.

Writing unit tests for the current AuthModal seems hard -- the authResponse generation logic is embedded in the react component's behavior. The easiest approach would be to:

  1. Move most of the logic out of the react component's componentWillReceiveProps, completeAuthResponse and login functions -- we should be able to test that logic without making react component tests
  2. Write tests for above logic
  3. Write tests for remaining react component
hstove commented 5 years ago

Things to test:

markmhendrickson commented 5 years ago

@hstove Want to pick this issue up for the current sprint or wait for a subsequent one?

hstove commented 5 years ago

Yes I'd like to take this on.