Skip to content

Commit 41ffffb

Browse files
committed
Add test for compound components on custom instance.
1 parent be2444c commit 41ffffb

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/spec.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -387,6 +387,19 @@ test("createInstance allows setting default props", async () => {
387387
expect(onResolve).toHaveBeenCalledWith("done")
388388
})
389389

390+
test("custom instances also have helper components", async () => {
391+
const promiseFn = () => resolveTo("done")
392+
const CustomAsync = createInstance({ promiseFn })
393+
const { getByText } = render(
394+
<CustomAsync>
395+
<CustomAsync.Loading>loading</CustomAsync.Loading>
396+
<CustomAsync.Resolved>resolved</CustomAsync.Resolved>
397+
</CustomAsync>
398+
)
399+
await waitForElement(() => getByText("loading"))
400+
await waitForElement(() => getByText("resolved"))
401+
})
402+
390403
test("an unrelated change in props does not update the Context", async () => {
391404
let one
392405
let two

0 commit comments

Comments
 (0)