File tree Expand file tree Collapse file tree
spec/cljx/xapi_schema/schemata
src/cljx/xapi_schema/schemata Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- (defproject com.yetanalytics /xapi-schema " 0.1.0 "
1+ (defproject com.yetanalytics /xapi-schema " 0.1.1 "
22 :description " Clojure(script) Schema for the Experience API v1.0.3"
33 :url " https://github.com/yetanalytics/xapi-schema"
44 :license {:name " Eclipse Public License"
Original file line number Diff line number Diff line change 239239 " enum" " Not in #{\" foo\" \" bar\" \" baz\" }: quxx"
240240 " one" [" Not present: at least one string" ]}
241241 (errors->data @err))))
242- (context " given some xapi validation cases"
242+ (context " given some xapi validation cases"
243+ (with bad-xapi (errors->data
244+ (s/check json/Statement
245+ (assoc d/long-statement
246+ " actor"
247+ {" mbox" " mailto:milt@yetanalytics.com"
248+ " objectType" " NotAnAgent" }))))
243249 (it " parses an agent objectType error"
244250 (should-not-throw
245- (errors->data
246- (s/check json/Statement
247- (assoc d/long-statement
248- " actor"
249- {" mbox" " mailto:milt@yetanalytics.com"
250- " objectType" " NotAnAgent" })))))))
251+ @bad-xapi))
252+ (it " coerces the errors to strings"
253+ (should= {" actor" {" objectType" " Not Agent: NotAnAgent" }}
254+ @bad-xapi))))
251255 (describe
252256 " errors->paths"
253257 (it " returns a map"
Original file line number Diff line number Diff line change 148148 (if (named-error? node)
149149 (let [name #+clj (.name node) #+cljs (.-name node)
150150 error #+clj (.error node) #+cljs (.-error node)]
151- error)
151+ ( strip-named error) )
152152 node))
153153
154154(defn errors->data [e & [ltag]]
You can’t perform that action at this time.
0 commit comments