Let the runner report a failed save
The runner needs the original save error to report a failure.
your task
On failure, let the runner receive the error. Print nothing from checkSave on that path. On success, print “check: ” followed by the result, then “pass”.
A save with an empty room name fails. The starter prints “save failed, continuing” and then “pass”. The runner already knows how to report a save error.
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 yetA booking for Atlas
Expected output
1
check: saved Atlas2
passSee the input and the code for this case
function saveBooking(room) {
if (room === "") return Promise.reject(new Error("A room is required"));
return Promise.resolve("saved " + room);
}try {
await checkSave("Atlas");
} catch (error) {
console.log("fail: " + error.message);
}Not run yetAn empty room name
Expected output
1
fail: A room is requiredSee the input and the code for this case
function saveBooking(room) {
if (room === "") return Promise.reject(new Error("A room is required"));
return Promise.resolve("saved " + room);
}try {
await checkSave("");
} catch (error) {
console.log("fail: " + error.message);
}