You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			18 lines
		
	
	
		
			685 B
		
	
	
	
		
			Clojure
		
	
			
		
		
	
	
			18 lines
		
	
	
		
			685 B
		
	
	
	
		
			Clojure
		
	
(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" {})))))
 |