facebook / facebook/relay

Unable to find unit/component test samples for relay-react components

Open
#2,964 8 comments 2 reactions 0 assignees View on GitHub
wontfix
Dominant language
Rust
Stars
19k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

We are trying to write the Unit and Component tests for our react relay components which has fragments and query renderers.
I am referring testing-relay-components link provided below.
https://relay.dev/docs/en/testing-relay-components

The documentation seems incomplete. There are many small items which this page does not explain well and to make things worse, I am not able to find single example on internet where this pattern has been implemented well.

So could you please share any working samples of this guide.
https://relay.dev/docs/en/testing-relay-components

**Questions:**

1) **@relay_test_operation** - Where is this located ? I included this in my query, by relay method can not identify this as valid thing

2) **Fragment container Tests -**
https://relay.dev/docs/en/testing-relay-components#fragment-container-tests

Please share the sample component used here, its not clear how to write the test query renderer which matches your component. I tried to write a query, but somehow my props are always empty. Its not populating any data.

3) **MockPayloadGenerator.generate ->** I cant see the generated data landing under props. I tried adding custom generators too, but still my 'props' always show empty data. No Mock data populated.

I am using TypeScript,babel-plugin-macros for graphql.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.