我正在使用带有react-testing-library的快速检查功能,但是我遇到了Async Await超时错误,但未提供其他信息。我可以像下面这样复制它:
import * as React from "react";
import * as fc from "fast-check";
import {render, wait, cleanup} from "@testing-library/react";
const Title = (props: { titles: string[] }) => {
return <>
{props.titles.map((t, i) => (<div key={i}>{t}</div>))}
</>
}
describe("RTL", () => {
it("should run test without timeout", async () => {
await fc.assert(
fc.asyncProperty(fc.array(fc.lorem(), 0, 10), async (titles) => {
const {findByText} = render(<Title titles={titles}/>)
for (const t in titles) {
const el = await findByText(t)
await expect(el).resolves.toBeDefined()
}
}).afterEach(async () => cleanup())
)
})
})
我已经创建了一个仓库来复制问题:https://github.com/kai-ming-91/fast-check-with-rtl