I am trying to write some tests for Day :08 Run a collection
This is my response body:
{
"results": [
{
"gender": "female",
"name": {
"title": "Miss",
"first": "Louna",
"last": "Fournier"
},
"location": {
"street": {
"number": 7581,
"name": "Rue Principale"
},
"city": "Villeurbanne",
"state": "Cher",
"country": "France",
"postcode": 30638,
"coordinates": {
"latitude": "-24.9843",
"longitude": "43.4648"
},
"timezone": {
"offset": "-2:00",
"description": "Mid-Atlantic"
}
},
"email": "[email protected]",
"login": {
"uuid": "526cff23-7dbb-484e-a2f5-755666e569e3",
"username": "yellowfrog507",
"password": "bugs",
"salt": "CYRTGp3l",
"md5": "e1db3a070c437203833aeb489ee03743",
"sha1": "c06d4a9517092b57bbe1ea090914b77f11d7ab77",
"sha256": "6d4db16a4a030d9fa56e0695d62178130dc69b2c1124796e04bf6cce347447cb"
},
"dob": {
"date": "1962-10-08T00:07:20.111Z",
"age": 59
},
"registered": {
"date": "2008-08-08T05:24:26.268Z",
"age": 13
},
"phone": "02-39-34-68-25",
"cell": "06-12-23-24-24",
"id": {
"name": "INSEE",
"value": "2NNaN79081850 66"
},
"picture": {
"large": "https://randomuser.me/api/portraits/women/36.jpg",
"medium": "https://randomuser.me/api/portraits/med/women/36.jpg",
"thumbnail": "https://randomuser.me/api/portraits/thumb/women/36.jpg"
},
"nat": "FR"
}
],
"info": {
"seed": "ba66a06ae496d715",
"results": 1,
"page": 1,
"version": "1.3"
}
}
and my test is
pm.test("Person is Female", () => {
const responseJson = pm.response.json();
pm.expect(responseJson.nat).to.eql("FR");
});
Error: Person is Female | AssertionError: expected undefined to deeply equal ‘FR’