I have this selector in my component whose default state is '' (empty)
string but when change
event is fired user can select any one of the three values that is 6, 12 or 24
it("feedform testing the selector feed frequency for value of 6, 12, 24 ", () => {
const addFeedForm = shallow(
<FeedForm
submitForm={() => {}}
setFeedData={() => {}}
formType="add"
feedsubmit={{
status: null,
error: {
formsubmitwarning: "",
feedname: "",
feedurl: "",
feedposttype: "",
feedfrequency: "",
feedpost: "",
feedhashtag: "",
formloginid: ""
}
}}
/>
);
expect(addFeedForm.state().feedfrequency).toEqual("");
addFeedForm.simulate("change");
expect(addFeedForm.state().feedfrequency).toEqual(6 || 12 || 24);
});
Now while writing unit test cases for this I quickly went through Jest documentation to find matcher for any one of the three value but found no matcher that does that.
I even tried using || (or)
operator in toEqual
and toBe
matcher but as you guessed it didn't work. Is there a way to make it work or should I skip the test all together?
Note: I am using Enzyme with Jest