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

Feature/add backend graphql integration #7

Merged
merged 13 commits into from
May 14, 2024

Conversation

zeroreign
Copy link
Owner

Warpping the Apollo GraphQL Client Provider to use Context API hooks to manage graphql requests.
Type benefits.
Looks like it is restricted to 'use client' for now with Context API
Testing is possible with backend server and no mocking!

Testing was doing with TDD in mind, but also trying to understand the component life cycle.
Goal here was to test the component without mocking the graphql client and provider
Thoughts with mocks:
 * Codegen to add the types from Graphql backend is available, but no data.
 * No need to setup backend server to test with mocks
 * Render would respond immediately instead of waiting for async http requests
 * Coupled to backend with mocks
 * Easier to test but will draw a box around complete actual usage of the component
Thoughts for calling backend:
 * Backend needs to be started for tests to run successfully
 * Required cross-fetch to polly fill jest tests not using actualy fetch api
 * Tests are slower for async rendering in tests
 * Understanding of render cycle and async testing in Jest and Testing React
 * Fitness test for frontend and server interaction
 * Testing backend compatability and changes
 * Test how the component is used for react life cycles
 * Might be able to test complete page without cypress.
 * Snapshot tests are more reliable
@zeroreign zeroreign merged commit 07ccf13 into main May 14, 2024
2 checks passed
@zeroreign zeroreign deleted the feature/add-backend_graphql-integration branch May 14, 2024 08:04
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.

1 participant