Week 3 | Lesson 15

Final Project & Assignment Work

Final Project Work



© 2026 by Monika Protivová

Practice

Assignment 06: Coffee Shop Testing

Write tests to find and fix bugs in a Coffee Shop system using Kotest

The Challenge

You've been given a Coffee Shop ordering system that has bugs. Your job is to write tests using Kotest to find and fix them.

The System

A coffee shop that manages:

  • Drinks: Espresso, Americano, Cappuccino, Latte, Flat White, Mocha
  • Sizes: Small (1x), Medium (1.25x), Large (1.5x price)
  • Orders: Customer name + list of drinks
  • Receipts: Subtotal, tax, total calculations

Your Tasks

  1. Read and understand the Coffee Shop code (PriceCalculator, CoffeeShop)
  2. Write Kotest tests covering:
    • Drink price calculation for all sizes
    • Order total calculation (including edge cases)
    • Tax calculation and discount logic
    • Order placement and receipt generation
  3. Find the bugs - Some tests will fail, revealing hidden bugs!
  4. Fix the bugs and verify all tests pass

Minimum Requirements

  • At least 10 tests for PriceCalculator
  • At least 5 tests for CoffeeShop
  • Cover edge cases: empty orders, negative values, boundary conditions