(ns wanijo.framework.routing-test (:require [clojure.test :refer :all] [wanijo.framework.routing :refer [parse-path]])) (deftest test-parse-path (testing "no params in path" (is (= (parse-path "a" {}) "a")) (is (= (parse-path "/a/b" {}) "/a/b"))) (testing "params are replaced" (is (= (parse-path "/a/:b" {:b 1}) "/a/1")) (is (= (parse-path "/a/:b" {:b "1"}) "/a/1")) (is (= (parse-path ":b" {:b 1}) "1")) (is (= (parse-path "/a/:b/c" {:b 1}) "/a/1/c"))) (testing "additional params are ignored" (is (= (parse-path ":a" {:a 1 :b 2}) "1"))) (testing "all params are required" (is (thrown? RuntimeException (parse-path ":a" {})))))