# Comparing arrays: if array item is included at least once, the test should pass

**URL:** <https://community.postman.com/t/comparing-arrays-if-array-item-is-included-at-least-once-the-test-should-pass/11842>\
**Category:** Help Hub\
**Created:** [April 9, 2020, 10:31am UTC](https://community.postman.com/t/comparing-arrays-if-array-item-is-included-at-least-once-the-test-should-pass/11842 "2020-04-09T10:31:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![russellg](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/russellg/32/4729_2.png) [@russellg](https://community.postman.com/u/russellg)\
**Post date:** [April 9, 2020, 10:31am UTC](https://community.postman.com/t/comparing-arrays-if-array-item-is-included-at-least-once-the-test-should-pass/11842/1 "2020-04-09T10:31:40Z")

</div>

Apologies this is probably an easy problem but I am not 100% sure as to which ChaiJS test to use

say I generate an array of items from the response body:

```
let matches = [];
for (i = 0; i < response.length; i++) {
  // console.log(object[i].taskCode);
  matches.push(response[i].taskCode);
}

```

And that array may look like: `["2000", "2001", "2004", "2004", "2004", "2004", "2004", "2004", "2006", "2046"]`

In a data file, I have an array that looks like: `["2046", "2004", "2006"]`

so the test is something like: pm.expect(matches) **not sure what to put here** (taskCodes);

What I am trying to do with the test, is say, as long as the array ‘matches’ contains the values from ‘taskCodes’ at least once, it passes. However if the taskCodes array has an item the matches array does not, it should fail. Duplicate values do not matter.

---

<div class="post-metadata">

**Author:** ![russellg](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/russellg/32/4729_2.png) [@russellg](https://community.postman.com/u/russellg)\
**Post date:** [April 15, 2020, 4:44am UTC](https://community.postman.com/t/comparing-arrays-if-array-item-is-included-at-least-once-the-test-should-pass/11842/2 "2020-04-15T04:44:48Z")

</div>

Apologies everyone, this was faily straightforward. The answer obviously was: .to.include.members
