I am currently utilizing the following versions:
- Node.js: 9.8.0
- Jest: 22.4.2
A function called myFunction is returning an array structured like this:
[
...
{
id: 00000000,
path: "www.someUrl.com/some/path/to"
}
...
]
I am trying to compare it with a similar array structure like below:
const output = [
...
{
id: 00000000,
path: "path/some/path/to"
}
...
]
In essence, I need the id values to match exactly, but only partially match the path.
However, I'm having some difficulty implementing this... I attempted using the code snippet below:
expect(myFunction()).toEqual(expect.arrayContaining(output));
But unfortunately, this approach is resulting in an error.