Read the body before you check it
Check the requested booking details once the response body is available.
your task
Check the room and hours against expected when the body is available. Print “pass” when both match. Otherwise print “fail”. Field order and the timestamp must not affect the result.
The check rejects the correct booking for Atlas. response.json() supplies the body through a promise. The server includes a timestamp and can send the fields in a different order.
Run code runs your code once for each case. It compares what your code prints with the expected output.
Starter code
or press Ctrl EnterNot run yet
cases
Not run yetCorrect booking, different field order
Expected output
1
passSee the input and the code for this case
const response = {
status: 200,
json() {
return Promise.resolve({ updatedAt: "2026-05-01T09:30:00Z", hours: 2, room: "Atlas" });
},
};
const expected = { room: "Atlas", hours: 2 };Not run yetThe hours are wrong
Expected output
1
failSee the input and the code for this case
const response = {
status: 200,
json() {
return Promise.resolve({ room: "Atlas", hours: 5, updatedAt: "2026-05-01T09:31:00Z" });
},
};
const expected = { room: "Atlas", hours: 2 };Not run yetThe room is wrong
Expected output
1
failSee the input and the code for this case
const response = {
status: 200,
json() {
return Promise.resolve({ room: "Birch", hours: 2, updatedAt: "2026-05-01T09:32:00Z" });
},
};
const expected = { room: "Atlas", hours: 2 };