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

rename and add tests to useDocumentQuery #101

Merged
merged 9 commits into from
Sep 24, 2024

Conversation

HassanBahati
Copy link
Collaborator

@HassanBahati HassanBahati commented Sep 15, 2024

This PR tests the useDocumentQuery hook for the following assertions;

  • fetches document from server source
  • handles fetch errors
  • returns pending state initially
  • returns correct data type

Copy link

docs-page bot commented Sep 15, 2024

To view this pull requests documentation preview, visit the following URL:

react-query-firebase.invertase.dev/~101

Documentation is deployed and generated using docs.page.

@HassanBahati
Copy link
Collaborator Author

@Ehesp

expect(result.current.isError).toBe(true);
});

expect(result.current.error).toBeDefined();
Copy link
Member

Choose a reason for hiding this comment

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

Could we make a test utility here which does something along the lines of expectFirestoreError(result.current.error, 'firebase-code'), and both checks .code is defined and matches what is expected? We could hit a false positive here with it being an error unrelated to the none existent doc.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

sure yes, i do agree. let me setup a utility to run that check

@HassanBahati HassanBahati changed the title Add useFirestoreDocument tests rename and add tests to useDocumentQuery Sep 24, 2024
Copy link
Member

@Ehesp Ehesp left a comment

Choose a reason for hiding this comment

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

🚢

@Ehesp Ehesp merged commit 0c26c49 into invertase:next Sep 24, 2024
2 of 4 checks passed
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.

2 participants