Is there a way to create a jest test specifically for this function?
const input = require('prompt-sync')();
export function choices(): void {
const choice = input("Choose a letter");
if (choice === "a") {
console.log("Airplane");
} if (choice === "b") {
console.log("Balloon");
} else {
console.log("Neither");
}
}
I am aware that mocking is necessary in this scenario. However, I am uncertain about how to implement it when the input is stored within the function itself rather than being passed as a parameter. I would prefer not to alter this setup.