We move to new markets that use different drink makers.
In this iteration, your task is to make our CoffeeMachine work with two new models of drink maker:
- DrinkMaker-1000
- DrinkMaker-3000
Your product owner has delivered the stories and here they are:
- The DrinkMaker-1000 should receive the correct instructions for all the drinks.
- The DrinkMaker-3000 should receive the correct instructions for all the drinks.
The CoffeeMachine should still work with the old DrinkMaker-800 model.
The DrinkMaker-1000 protocol is comprised of two functions:
-
make: It is used to make drinks. It receives two parameters: a string indicating the drink and an integer indicating the number of sugars. Some examples:
make("T", 1)
-> DrinkMaker-1000 makes 1 tea with 1 sugar and a stickmake("HC", 0)
-> DrinkMaker-1000 makes 1 chocolate with no sugar - and therefore no stickmake("C", 2)
-> DrinkMaker-1000 makes 1 coffee with 2 sugars and a stick -
notify: It is used to deliver info messages to the customer. Some examples:
notify("message-content")
-> DrinkMaker-1000 forwards any message received onto the coffee machine interface for the customer to see
The DrinkMaker-3000 protocol is comprised of one function for each type of drink and a function to forwards messages to the user:
-
makeCoffee: It is used to make coffee. It receives an integer indicating the number of sugars. Some examples:
makeCoffee(0)
-> DrinkMaker-3000 makes 1 coffee with no sugar - and therefore no stickmakeCoffee(1)
-> DrinkMaker-3000 makes 1 coffee with 1 sugar and a stick -
makeTea: It is used to make tea. It receives an integer indicating the number of sugars. Some examples:
makeTea(0)
-> DrinkMaker-3000 makes 1 tea with no sugar - and therefore no stickmakeTea(2)
-> DrinkMaker-3000 makes 1 tea with 2 sugar and a stick -
makeChocolate: It is used to make chocolate. It receives an integer indicating the number of sugars. Some examples:
makeChocolate(0)
-> DrinkMaker-3000 makes 1 chocolate with no sugar - and therefore no stickmakeChocolate(2)
-> DrinkMaker-3000 makes 1 chocolate with 2 sugar and a stick -
display: It is used to deliver info messages to the customer. Some examples:
display("message-content")
-> DrinkMaker-3000 forwards any message received onto the coffee machine interface for the customer to see
- To know how to spy and stub interactions with Jest have a look at these examples.