              [:references]
              (partial map (partial into {}))))
 
-(defspec search-result->response-test
+(defspec search-result->response-test 100
   (for-all [result results-gen/results
             format (gen/elements [:json :xml])]
     (let [resp (s/search-results->response result format)

(ns cmr.search.test.api.search-results
  (:require [clojure.test :refer :all]
            [clojure.test.check.clojure-test :refer [defspec]]
            [clojure.test.check.properties :refer [for-all]]
            [clojure.test.check.generators :as gen]
            [clojure.walk :as walk]

(defn ref-xml-struct->reference
  "Converts a parsed XML reference into a map"
  [xml-struct]
  {:concept-id (cx/string-at-path xml-struct [:concept-id])
   :revision-id (cx/long-at-path xml-struct [:revision-id])
   :provider-id (cx/string-at-path xml-struct [:provider-id])
   :entry-title (cx/string-at-path xml-struct [:entry-title])})

(defmethod parse-search-results-response :xml
  [response-str format]
  (let [xml-struct (x/parse-str response-str)
        hits (cx/long-at-path xml-struct [:hits])
        ref-structs (cx/content-at-path xml-struct [:references])
        references (map ref-xml-struct->reference ref-structs)]
    {:hits hits
     :references references}))
