Skip to content

Conversation

@HassanBahati
Copy link
Member

@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
@docs-page
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 HassanBahati force-pushed the add-usefirestoredocument-tests branch from 7c42b42 to 4f6e660 Compare September 15, 2024 11:16
@HassanBahati
Copy link
Member Author

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
Member 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 requested a review from Ehesp September 24, 2024 14:08
@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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants