Changing decision points
The way we pass the string that customizes a path is through a single environmental variable, like so:
Set JOURNEY=""; yarn ch15
This way, we can create test several paths. In this example, the user does not attend the party and instead clicks the I’m scared button:
Set JOURNEY="attend scared"; yarn ch15
With this example, the user takes the path to host the party with a zombie theme:
Set JOURNEY="Host ZOMBIE"; yarn ch15
A single environmental value can modify multiple decision points from the Happy Path baseline. While an empty string by default will create a Happy Path, the best practice is to assign the string so that the path is shown in the results, with the parsing being case-insensitive.
let journey: string = " " + (process.env.JOURNEY || "Host").toLowerCase(); if (journey===" ")) { journey = " host"; //Default Happy Path }
Note that...