webdevatlanta / GroupCollaborationTool

Tool to allow developers to collaborate on open source and private projects
https://groupcollaborationtool.web.app
1 stars 21 forks source link

Refactor tests with TestProvider component #123

Closed DanielJWagener closed 4 years ago

DanielJWagener commented 4 years ago

This is an extensive and unwarranted refactor of most the tests in the codebase. Basically, I abstracted the nested MemoryRouter, fake Session context, and fake Provider context into one component. One notable front-end change is that NameTag now gets its session value from context instead of props. After making that change, I figured out a way to pass in falsy fake sessions into TestProvider and have all the tests still pass.

I know that refactors often come at the expense of legibility, so I'm open to criticism.

abrie commented 4 years ago

@DanielJWagener This looks great. Exactly what I had in mind when refactoring the Firebase stuff into the Provider interface. I feel like we're getting some confidence around how the system works. With this PR we're in a good position to refactor state management and tackle problems like the one you mention in https://github.com/webdevatlanta/GroupCollaborationTool/issues/78#issuecomment-608042377