jamesplease / jamesplease/react-composer

Unit testing <Composer> with nested <Fetch> components?

Open
#58 4 comments 0 reactions 0 assignees View on GitHub
question
Dominant language
JavaScript
Stars
607
Forks
17
PR merge metrics
No merged PRs in 30d

Description

Hi! Thanks for the great libraries! I'm running into some issues trying to write enzyme unit tests for a component that follows a pattern like this, where `Fetch` comes from `react-request`:

```

{([fetchA, fetchB]) => {
if (fetchA.failed || fetchB.failed) {
return ;
}
if (fetchA.fetching || fetchB.fetching) {
return ;
}
return ;
}}

```

Do you have any examples you can share of how to test this pattern? I seem to be having trouble getting at the underlying promise chain, so my tests complete before `fetchA, fetchB, fetchC` all resolve.

Thanks!

Contributor guide

Open the contributing guide

Research direction

The issue names no repository files or existing tests; start by reviewing the react-composer component usage and how nested react-request Fetch components expose their asynchronous state. Done would be a documented Enzyme example, or corresponding tests, that covers the loading, failure, and successful states after multiple fetches resolve.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, react
Domain
frontend, testing
Issue type
Documentation
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.