Here is an example of an object I have:
data =
{
"suites": [
{
"status": "fail",
"testcases": [
{
"status": "pass"
},
{
"status": "fail"
}
]
},
{
"status": "pass",
"testcases": [
{
"status": "pass"
}
]
}
]
}
I am trying to determine the count of test cases that have passed and failed (In this case pass: 2, fail: 1). I attempted the following code to get the pass count:
data.suites.filter(suite => {
suite.testcases.filter(testcase => {
return testcase.status === 'pass';
})
}).length
Unfortunately, the result is not what I expected.