-
Notifications
You must be signed in to change notification settings - Fork 44
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
Modernize the Apollo Client testing approach #43
Conversation
The current Apollo Client testing approach is based on a no longer supported library. This PR helps address this by: - Moving to the `@apollo/client` dependency (currently an RC version of 3.4) - Switching the `react-apollo` naming for `apollo-client` (`react-apollo` has been deprecated) - Simplifying the Apollo test application using Reactive Variables and our field policy API Some of the Apollo Client tests still fail, but this is a stepping stone in our React 18 work.
const useIncrement = () => { | ||
return () => { | ||
return currentState(reducer(currentState(), incrementAction)); | ||
}; | ||
}; | ||
|
||
const useDouble = () => { | ||
return () => { | ||
return currentState(reducer(currentState(), doubleAction)); | ||
}; | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please note that the useIncrement
and useDouble
naming is a bit misleading here since these are not hooks, but I kept the naming as is to line up with what createApp
is expecting.
new webpack.DefinePlugin({ | ||
__DEV__: JSON.stringify(process.env.NODE_ENV !== "production"), | ||
}), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apollo Client has moved away from using process.env.NODE_ENV
to __DEV__
(details here). This slight tweak is intended to help Webpack recognize that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the updates! Sure, let's merge this.
Hi! First off, thanks very much for putting this wonderful testing repo together. πββοΈ We (Apollo) are planning on using it for some of our React 18 testing. To kick things off though, we noticed this project is using a no longer supported library/version of our React integration. This PR includes a few changes to help correct this, such as:
@apollo/client
dependency (currently an RC version of 3.4)react-apollo
naming forapollo-client
(react-apollo
has been deprecated)Is this something you would be interested in merging? This doesn't change our failed test status, but it's a start to make sure the test application is using a more current Apollo Client approach. We'll be sure to report back when we have all tests passing. Thanks!
cc @benjamn @brainkim