Replies: 2 comments
-
Hey! Did you solve this problem? |
Beta Was this translation helpful? Give feedback.
0 replies
-
main.js
main.test.js
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
import ky from "ky";
jest.mock("ky");
it("should fetch data", () => {
ky.post.mockResolvedValue(() => ({
json: () => Promise.resolve(resp),
}));
}
)
the snippet above results in an error
"_ky.default.post(...).json is not a function"
The main question is: What is the correct way to use jests' mockResolvedValue with ky? I have not found any examples of this usage yet. any examples would be greatly appreciated.
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions