Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This is the beginning of a suite of tests for schema correctness.
- Loading branch information
1 parent
81b55c4
commit c20d099
Showing
4 changed files
with
46 additions
and
10 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
(ns juxt.jsonschema.core) | ||
|
||
(defn array? [x] | ||
(sequential? x)) | ||
|
||
(defn object? [x] | ||
(map? x)) | ||
|
||
(defn schema? [x] | ||
(or (object? x) (boolean? x))) |
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,14 @@ | ||
(ns juxt.jsonschema.schema-test | ||
(:require | ||
[juxt.jsonschema.schema :refer [schema]] | ||
[clojure.test :refer [deftest is are testing]] | ||
[juxt.jsonschema.schema :as schema]) | ||
(:import | ||
(clojure.lang ExceptionInfo))) | ||
|
||
(deftest schema-test | ||
(testing "bad types" | ||
(is | ||
(thrown? | ||
ExceptionInfo | ||
(schema {"type" 10}))))) |