-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #33 from pitch-io/example-tests
Create example tests directory
- Loading branch information
Showing
5 changed files
with
33 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
(ns examples.async-test | ||
(:require [cljest.core :refer [is it spy]] | ||
[cljest.helpers.core :as h] | ||
[cljest.matchers :as m])) | ||
|
||
(defn ^:private fire-async | ||
"Calls given `cb` asynchronously (on the next tick)." | ||
[cb] | ||
(js/process.nextTick cb)) | ||
|
||
(it "fire-async calls the cb asynchronously" | ||
(let [cb (spy)] | ||
(fire-async cb) | ||
(is (not (m/called? cb))) | ||
|
||
(h/async | ||
(await (js/Promise. (fn [res] (js/setTimeout res)))) | ||
(is (m/called? cb))))) |
2 changes: 1 addition & 1 deletion
2
cljest/src/cljest/example_test.cljs → ...xample_tests/examples/component_test.cljs
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