# 30 Days Challenge - Day 13 Newman

**URL:** <https://community.postman.com/t/30-days-challenge-day-13-newman/49575>\
**Category:** Help Hub\
**Tags:** 30-days\
**Created:** [July 14, 2023, 8:16pm UTC](https://community.postman.com/t/30-days-challenge-day-13-newman/49575 "2023-07-14T20:16:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![mattiamangia](https://avatars.discourse-cdn.com/v4/letter/m/848f3c/32.png) [@mattiamangia](https://community.postman.com/u/mattiamangia)\
**Post date:** [July 14, 2023, 8:16pm UTC](https://community.postman.com/t/30-days-challenge-day-13-newman/49575/1 "2023-07-14T20:16:00Z")

</div>

_My question_:  
Hello Everyone.  
Working on Day 13 challenge. I did everything requested and reached the submit request but having 2 errors in test Results which are:  
FAIL  
Requests added correctly | AssertionError: check number of requests: expected +0 to equal 2  
FAIL  
Tests and Scripts added correctly | TypeError: Cannot read properties of undefined (reading ‘event’)

_Details (like screenshots)_:

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/5/0/5016931c0d4b0b125f79b2814be111ac26b79dee.png)

Here details about tests I wrote for planets and species requests:

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/4/d/4dadf104e2236226b0c66ffae0b82784ec0b32cb.png)

 ![image](https://us1.discourse-cdn.com/getpostman/original/3X/c/3/c331cd1fc189238cfa8ef386dbf3383ca31e402b.png)

How Can I manage this situation?

---

<div class="post-metadata">

**Author:** ![michaelderekjones](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/michaelderekjones/32/14819_2.png) [@michaelderekjones](https://community.postman.com/u/michaelderekjones)\
**Post date:** [July 17, 2023, 10:32am UTC](https://community.postman.com/t/30-days-challenge-day-13-newman/49575/2 "2023-07-17T10:32:09Z")

</div>

This is the test that is failing.

```auto
pm.test("Requests added correctly", () => {
    pm.expect(collection.item[0].item.length, 'check number of requests').equals(2)

    let planetRequest = collection.item[0].item.find(req => { return req.name === "planets"})
    pm.expect(planetRequest.name, 'check planet name').equals("planets")
    pm.expect(planetRequest.request.method, 'check planet method').equals("GET")
    pm.expect(planetRequest.request.url.raw, 'check planet url').includes("https://swapi.dev/api/planets")

    let speciesRequest = collection.item[0].item.find(req => { return req.name === "species"})
    pm.expect(speciesRequest.name, 'check species name').equals("species")
    pm.expect(speciesRequest.request.method, 'check species method').equals("GET")
    pm.expect(speciesRequest.request.url.raw, 'check species url').includes("https://swapi.dev/api/species")

    pass += 1
})

```

In particular, I suspect it will be the references to the following

```auto
collection.item[0]

```

Which is causing both tests to fail.

This should bring back the “Newman” folder but I suspect for some reason, its not.

I would need to see the JSON returned in the “Submit” request to advise further.

Otherwise I would recommend cloning the submit request and adding a few console logs to the code.

```auto
console.log(collection.item[0]);

```

What does that return?
