wise-white
wise-whiteβ€’2y ago

How to mock and test Selections

Hi. Im having a hard time on jest testing the Select. Is there a sample reference online? Thank you
6 Replies
refine-support-bot
refine-support-botβ€’2y ago
Hi, I am refine support bot :wave:. I am here to help you with your question. I searched for the answer to your question in the refine documentation and found an answer! πŸ†
Answer: Refer to the refine useSelect hook documentation for more information on how to mock and test Selections. SOURCES: ./docs/api-reference/core/hooks/useSelect/index.md

Note: If this is the answer you need, then we are very lucky. If not, please wait for someone from the refine core team or the community to try to help you.
loud-coral
loud-coralβ€’2y ago
Hi @thedevkim, can you give me more detail ? do you wanna test <Select> component from @pankod/refine-antd ?
wise-white
wise-whiteβ€’2y ago
Yes i want to test the <Select> component from @pankod/refine-antd Like, the selecting of options etc. @alicanerdurmaz
loud-coral
loud-coralβ€’2y ago
Unfortunately, I don't have a resource in mind that I can recommend for this. maybe other people in community can recommend. but i wanna clearify something. The select component is exported from antd without any changes. So every solution you apply for antd components is also valid for refine-antd
wise-white
wise-whiteβ€’2y ago
The issue im getting is that, testing the events for <Select> with fireEvent. Like selecting options etc. I want to fireEvent onChange of the <Select> component in jest. Do you have any ideas?
loud-coral
loud-coralβ€’2y ago
Unfortunately i have not πŸ˜• if you ask on antd forums, probably you will get faster answer