Open a pull request and submit your solution for this test with typescript.
Write a program that can build many cake with many toppings like : βCupcake with chocolate and nutsβ Or βπ§ with black π« and π₯ and π¬β. Be carful the order of topping is very important.
Write a function or method they can show the name of cake.
Write a function they can show the price of cake. The price is composed from base cake price and topping price.
In pseudo code to build a Cupcake with chocolate and nuts and sugar you will write
const myCake = new Sugar(new Nuts(new Chocolate(new Cupcake())));
About name function or method
-
The name function should return βπ§β
-
The name function should return βπͺβ
-
The name function should return βπ§ with π«β
-
The name function should return βπͺ with π«β
-
The name function should return βπͺ with π« and π₯β
-
The name function should return βπͺ with π₯ and π«β
About price function or method
-
The price function should return 1$ for βπ§β
-
The price function should return 2$ for βπͺβ
-
The price function should return 1.1$ for βπ§ with π«β
-
The price function should return 2.1$ for βπͺ with π«β
-
The price function should return 2.2$ for βπͺ with π₯β
Clone this project:
git clone https://github.com/jhorlima/tests2solved-ts.git
Enter in project folder:
cd tests2solved-ts
Install the dependencies:
npm ci
Run the tests:
npx jest
Fix classes so tests pass.