Commit 3f7604d0 authored by Nate Wolfe's avatar Nate Wolfe

Comment cleanup and add validation precondition

parent fd2b11fd
......@@ -38,13 +38,11 @@
:line { :optional? true
:type :integer }})
;; TODO: update this as we add new fields
;; TODO: docs
(def v2-new-event-fields [:file :line])
(defn validate-and-add-v2-event-field!
;; TODO: docs
[event field]
{:pre [(utils/seq-contains? v2-new-event-fields field)]}
(if (contains? event field)
(throw (IllegalArgumentException.
......@@ -53,7 +51,6 @@
(assoc event field nil))
(defn validate-and-add-v2-event-fields!
;; TODO: docs
(let [updated-event (reduce
......@@ -128,6 +128,11 @@
(constructor item))))
(defn seq-contains?
"True if seq contains elm"
[seq elm]
(some #(= elm %) seq))
(defn mapvals
"Return map `m`, with each value transformed by function `f`.
......@@ -19,7 +19,6 @@
v2-report (munge-v1-example-report-to-v2 v1-report)]
(is (= v2-report (validate! 1 v1-report)))))
;; TODO: uncomment this as soon as we've added :file to v2-new-event-fields
(testing "should fail when a v1 report has a v2 key"
(let [add-key-fn (fn [event] (assoc event :file "/tmp/foo"))
v1-report (munge-v2-example-report-to-v1 report)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment