Welcome to your third unit for this course dedicated to practicing Test Driven Development (TDD) utilizing TypeScript and Jest. We're going to start building a new system; this time we'll build a shopping cart class with a lot of features.
In this course, emphasis is placed on hands-on practice, where you'll receive requirements through tests, one at a time. Your task is to write tests AND implement code that makes each test pass, simulating a real-world TDD environment. Where I wrote the tests for you last time, this time it's all up to you!
Remember to use the core concepts of the Red-Green-Refactor cycle while completing these coding exercises. I'm still here to help! Just ask.
- Description: When a new shopping cart is created, it should start without any items, and the total price should be zero.
- Details
- initialize a new shopping cart using the
ShoppingCartconstructor - ensure
getItemCount()returns0for an empty cart - verify
getTotal()returns0for the initial state.
- initialize a new shopping cart using the
- Examples: a newly created cart should have a count of
0and a total of
