ugly-tan
ugly-tanβ€’16mo 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β€’16mo 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.
harsh-harlequin
harsh-harlequinβ€’16mo ago
Hi @thedevkim, can you give me more detail ? do you wanna test <Select> component from @pankod/refine-antd ?
ugly-tan
ugly-tanβ€’16mo ago
Yes i want to test the <Select> component from @pankod/refine-antd Like, the selecting of options etc. @alicanerdurmaz
harsh-harlequin
harsh-harlequinβ€’16mo 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
ugly-tan
ugly-tanβ€’16mo 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?
harsh-harlequin
harsh-harlequinβ€’16mo ago
Unfortunately i have not πŸ˜• if you ask on antd forums, probably you will get faster answer