|
1 | 1 | (ns cider.nrepl.middleware.slurp-test
|
2 | 2 | (:require
|
3 |
| - [cider.nrepl.middleware.slurp :refer [if-class slurp-url-to-content+body]] |
| 3 | + [cider.nrepl.middleware.slurp :refer [slurp-url-to-content+body]] |
4 | 4 | [clojure.java.io :as io]
|
5 | 5 | [clojure.test :as t]
|
6 | 6 | [clojure.string :as str]))
|
7 | 7 |
|
8 |
| -;; FIXME (arrdem 2018-04-11): |
9 |
| -;; Remove these if-classes when we have jdk1.8 min |
10 |
| -(if-class java.util.Base64 |
11 |
| - (t/deftest test-project-clj-is-clj |
12 |
| - (let [resp (slurp-url-to-content+body |
13 |
| - (.toString |
14 |
| - (.toURL |
15 |
| - (io/file "project.clj"))))] |
16 |
| - (t/is (= ["text/clojure" {}] (:content-type resp))) |
17 |
| - (t/is (not= "base64" (:content-transfer-encoding resp)))))) |
| 8 | +(t/deftest test-project-clj-is-clj |
| 9 | + (let [resp (slurp-url-to-content+body |
| 10 | + (.toString |
| 11 | + (.toURL |
| 12 | + (io/file "project.clj"))))] |
| 13 | + (t/is (= ["text/clojure" {}] (:content-type resp))) |
| 14 | + (t/is (not= "base64" (:content-transfer-encoding resp))))) |
18 | 15 |
|
19 |
| -(if-class java.util.Base64 |
20 |
| - (t/deftest test-sum-types-is-base64 |
21 |
| - (let [resp (slurp-url-to-content+body |
22 |
| - (.toString |
23 |
| - (io/resource "sum-types-are-cool.jpg")))] |
24 |
| - (t/is (= ["image/jpeg" {}] (:content-type resp))) |
25 |
| - (t/is (= "base64" (:content-transfer-encoding resp)))))) |
| 16 | +(t/deftest test-sum-types-is-base64 |
| 17 | + (let [resp (slurp-url-to-content+body |
| 18 | + (.toString |
| 19 | + (io/resource "sum-types-are-cool.jpg")))] |
| 20 | + (t/is (= ["image/jpeg" {}] (:content-type resp))) |
| 21 | + (t/is (= "base64" (:content-transfer-encoding resp))))) |
26 | 22 |
|
27 |
| -(if-class java.util.Base64 |
28 |
| - (t/deftest test-unrecognized-file |
29 |
| - (let [resp (slurp-url-to-content+body |
30 |
| - (.toString (io/resource "unknown.bin")))] |
31 |
| - (t/is (= ["application/octet-stream" {}] (:content-type resp))) |
32 |
| - (t/is (str/starts-with? (:body resp) "#binary[location=")) |
33 |
| - (t/is (str/ends-with? (:body resp) ",size=3]"))))) |
| 23 | +(t/deftest test-unrecognized-file |
| 24 | + (let [resp (slurp-url-to-content+body |
| 25 | + (.toString (io/resource "unknown.bin")))] |
| 26 | + (t/is (= ["application/octet-stream" {}] (:content-type resp))) |
| 27 | + (t/is (str/starts-with? (:body resp) "#binary[location=")) |
| 28 | + (t/is (str/ends-with? (:body resp) ",size=3]")))) |
0 commit comments