How to do jest testing on array.every method in javascript
I am developing a project in react js .I am new to this field. But I stuck in jest testing .I developed this :-
I have one array (breeds).
const breeds =
{ breeds
[ {id : 1,
model: cern ,
dogs: name1: 'peter', name2:'jetsky', name3:'robin',}
]}
I have an object (Dogs).
const Dogs = object.freeze({ name1 : 'peter', name2 : 'jetsky', })
I changed it to array like this
const dogsname =object.values(Dogs);
Then I need to compare this array of subset present of main array or not :
So for this I did this
const value = breeds.every(val=> dogsname.includes(val).
So I am able to get the data that it is subset of main array.
Now I am doing unit testing on this with jest framework.But not able to get this. I did this :
test ('render the element which is present in array',()=>{
const dogsname = object.values(Dogs);
const breedname = breeds.dogs; expect(breedname).toEqual(expect.arrayContaining(dogsname)); })
But its showing error received: undefined, not able to do that testing .Thanks!