-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* async handlers * fix test * split async tests * fix indent * 0.2.1
- Loading branch information
Showing
11 changed files
with
75 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
|
||
(deftype NilItem [] | ||
p/Item | ||
(handle [_ _] nil) | ||
(process [_ _] nil) | ||
(fill [_ _] nil)) | ||
|
||
(defn nil-item [] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
(ns darkleaf.router-async-test | ||
(:require [darkleaf.router :as r] | ||
[clojure.test :refer [deftest is]])) | ||
|
||
(deftest async-handler | ||
(let [pages-controller {:index (fn [req resp raise] | ||
(future | ||
(resp "index resp")) | ||
:something)} | ||
pages (r/resources :pages :page pages-controller) | ||
handler (r/make-handler pages) | ||
test-req {:uri "/pages", :request-method :get} | ||
done? (promise) | ||
check (fn [val] | ||
(is (= "index resp" val)) | ||
(deliver done? true))] | ||
(handler test-req check check) | ||
(is (deref done? 100 false)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
(ns darkleaf.router-async-test | ||
(:require [darkleaf.router :as r]) | ||
(:import [goog.async nextTick]) | ||
(:require-macros [cljs.test :refer [deftest is async]])) | ||
|
||
(deftest async-handler | ||
(async done | ||
(let [pages-controller {:index (fn [req resp raise] | ||
(nextTick #(resp "index resp")) | ||
:something)} | ||
pages (r/resources :pages :page pages-controller) | ||
handler (r/make-handler pages) | ||
test-req {:uri "/pages", :request-method :get} | ||
check (fn [val] | ||
(is (= "index resp" val)) | ||
(done))] | ||
(handler test-req check check)))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
(ns darkleaf.test-runner | ||
(:require [doo.runner :refer-macros [doo-tests]] | ||
[darkleaf.router-test] | ||
[darkleaf.router-async-test] | ||
[darkleaf.router.util-test])) | ||
|
||
(doo-tests 'darkleaf.router-test | ||
'darkleaf.router-async-test | ||
'darkleaf.router.util-test) |