Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Even more tests #56

Merged
merged 6 commits into from
Oct 24, 2020
Merged

Even more tests #56

merged 6 commits into from
Oct 24, 2020

Conversation

paytonagreen
Copy link
Collaborator

Description:

Added more tests for Header, GardenList, Profile, and App components, and did some slight reformatting to standardize user flow (updated App to use useUser hook rather than getToken to determine routing).

Tests:

Most changes are made to tests themselves, but other changes are addressed by tests.

Checklist:

Please put an x in each box that you have completed

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code in any hard-to-understand areas
  • My changes generate no new warnings or errors
  • I have added test instructions that prove my fix is effective or that my feature works

Copy link
Collaborator

@harpality harpality left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice just some quick thoughts

});

it("the hamburger button toggles the menu", async () => {
act(() => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could try and put this act resize function in its own function since we're writing it twice - (and probably will use it more)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the feedback! Pushing this up right now. I extracted it from the tests but left it in the file (with an export), since at the moment I'm not sure where its best long-term home would be.

@@ -1,10 +1,12 @@
import { useQuery } from '@apollo/client';
import { CURRENT_USER_QUERY } from 'queries'

export const useUser = () => {
function useUser() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just something to think about, could maybe do something like:

const { data, loading } = useQuery(CURRENT_USER_QUERY);

if (!loading) {
const {currentUser} = data;
return currentUser;
}

also feel like useUser is a little weird tongue twister of a name lol, maybe we can do useCurrentUser?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good thinking! Changed the name and updated all imports. Refactored as suggested here adding in a possible error state as well:

if (!loading && !error)

@paytonagreen paytonagreen merged commit 119d6d2 into master Oct 24, 2020
@paytonagreen paytonagreen deleted the even-more-tests branch October 24, 2020 22:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants