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

breaking(nova-react-test-utils): add support for Relay #103

Merged
merged 50 commits into from
Sep 4, 2024

Conversation

sjwilczynski
Copy link
Contributor

@sjwilczynski sjwilczynski commented Aug 22, 2024

Joint work with @jakobkhansen

In scope of this PR we add support for using Relay client with the Nova decorator and add a feature of specifying query needed to be run and way to pass result of that query to the component rendered in Story. Check the documentation that we added in README for more details about the features.

Additionally we changed the structure of the package so that now users have access to same functions for both client but need to import from different paths. For example:

  • to import Relay based utils one needs to do import { getNovaDecorator } from "@nova/react-test-utils" or import { getNovaDecorator } from "@nova/react-test-utils/relay"
  • to import Apollo based utils one needs to do import { getNovaDecorator } from "@nova/react-test-utils/apollo"
    Same patterns applies for utilities for unit tests

To verify our work, we added more stories and tests in packages/examples now showcasing both GraphQL client variants

@ansemb
Copy link
Member

ansemb commented Aug 23, 2024

I like having @nova/react-test-utils/apollo and @nova/react-test-utils/relay.

I wouldn't mind having the index.ts only for relay, hence have @nova/react-test-utils (relay) and @nova/react-test-utils/apollo as I think relay should be considered default going forward, though that might also feel weird.

@sjwilczynski
Copy link
Contributor Author

@ansemb

I like having @nova/react-test-utils/apollo and @nova/react-test-utils/relay.
I wouldn't mind having the index.ts only for relay, hence have @nova/react-test-utils (relay) and @nova/react-test-utils/apollo as I think relay should be considered default going forward, though that might also feel weird.

This is how it works right now actually. Because we set the main field as ./lib/relay/index.ts when importing without subpath it will use relay version. I decided to keep both subpaths for consistency tough

@sjwilczynski sjwilczynski marked this pull request as ready for review August 27, 2024 13:53
Copy link
Member

@Markionium Markionium left a comment

Choose a reason for hiding this comment

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

Forgot to complete this yesterday :)

@sjwilczynski sjwilczynski merged commit 5ed5ddc into microsoft:main Sep 4, 2024
2 checks passed
@sjwilczynski sjwilczynski deleted the feature/improvedDecorator branch September 4, 2024 16:34
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.

5 participants