10. Testing
Activity 10.01: Writing Tests for the Coffee-Ordering Application
Solution:
- Import the testing namespaces:
(ns coffee-app.utils-test     (:require [clojure.test :refer :all]               [coffee-app.core :refer [price-menu]]               [coffee-app.utils :refer :all]))
- Create tests using the
clojure.test
library to display the orders messages. - Test the application using the
is
macro:(deftest display-order-test         (testing "Multiple tests with is macro"                   (is (= (display-order {:number 4 :price 3.8 :type :latte}) "Bought 4 cups of latte for €3.8"))             ...