现在我有这样的结构来嘲笑请求。
我想测试jest.mock
内部的属性
import react from "react"
jest.mock("../../../api", () => ({
useGetRequest: () => ({
data: mockMyCards,
isLoading: false,
})
it(() => {
render()
// how to test that useGetRequest had been called, how to access insides of jest.mock
// expect(useGetRequest).toHaveBeenCalled()
})
字符串
1条答案
按热度按时间wh6knrhe1#
将模拟的
useGetRequest
Package 在jest.fn()
中。类似于:字符串