-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathutil_test.clj
More file actions
25 lines (22 loc) · 892 Bytes
/
util_test.clj
File metadata and controls
25 lines (22 loc) · 892 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
(ns getclojure.util-test
(:require
[clojure.test :refer (deftest testing is use-fixtures)]
[getclojure.util :as sut]
[schema.test :refer (validate-schemas)]))
(use-fixtures :once validate-schemas)
(deftest test-truncate
(testing "It truncates strings"
(is (= "abc"
(sut/truncate 3 "abc"))
"Does not truncate when the string is of a length equal to the truncation value")
(is (= "ab..."
(sut/truncate 2 "abc"))
"Truncates when the string is longer than the truncation value")
(is (= "abc"
(sut/truncate 4 "abc"))
"Does not truncate when the string smaller the truncation value")))
(deftest test-generate-query-string
(testing "It generates url-encoded query strings from maps"
(is (= "q=hi%21&num=42"
(sut/generate-query-string {:q "hi!"
:num 42})))))