You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/api/makeRenderRestHook.md
+11-2Lines changed: 11 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,8 +39,11 @@ type RenderRestHookFunction = {
39
39
callback: (props:P) =>R,
40
40
options?: {
41
41
initialProps?:P;
42
-
results?:Fixture[];
42
+
initialFixtures?:FixtureEndpoint[];
43
+
resolverFixtures?:FixtureEndpoint[];
43
44
wrapper?:React.ComponentType;
45
+
// @deprecated
46
+
results?:Fixture[];
44
47
},
45
48
): {
46
49
readonly result: {
@@ -64,13 +67,19 @@ to `renderRestHook()` will result in a completely fresh cache state as well as m
64
67
65
68
Hooks to run inside React. Return value will become available in `result`
66
69
67
-
#### options.results
70
+
#### options.initialFixtures
68
71
69
72
Can be used to prime the cache if test expects cache values to already be filled. Takes same
70
73
[array of fixtures as MockResolver](../api/MockResolver#fixtures)
71
74
72
75
This has the same effect as initializing [<CacheProvider />](../api/CacheProvider) with [mockInitialState()](../api/mockInitialState)
73
76
77
+
### options.resolverFixtures
78
+
79
+
These fixtures are used to resolve any new requests. This is most useful for mocking imperative fetches like mutations, but can also allow testing suspending states or transitions.
80
+
81
+
Wrrks by adding [MockResolver](../api/MockResolver) as a wrapper.
82
+
74
83
#### options.initialProps
75
84
76
85
The initial values to pass to the callback function
0 commit comments