 
 
 ;; Tests that all generated legacy-psa attribute stings can be converted to cmr format.
-(defspec legacy-psa->cmr-test 100
-  (for-all [legacy-psa legacy-psa-maps]
-    (let [legacy-query (legacy-psa-map->legacy-psa-query legacy-psa)
-          cmr-psa-query (legacy-psa-map->cmr-psa-query legacy-psa)
+(defspec legacy-psa->cmr-test 1
+  (for-all [legacy-psa (such-that not-empty (gen/vector legacy-psa-maps))]
+    (let [legacy-query (legacy-psa-maps->legacy-psa-query legacy-psa)
+          cmr-psa-query (legacy-psa-maps->cmr-psa-query legacy-psa)
           result (lp/process-legacy-psa {:page-size 10} legacy-query)]
-      (= {:page-size 10 :attribute [cmr-psa-query]} result))))
+      (= {:page-size 10 :attribute cmr-psa-query} result))))
+
+(lp/process-legacy-psa {} (legacy-psa-maps->legacy-psa-query [{:name "A,B" :type "string" :value nil :minValue "B,C" :maxValue "D,E"}]))
+
+(legacy-psa-maps->cmr-psa-query [{:name "A,B" :type "string" :value nil :minValue "B,C" :maxValue "D,E"}])
 
 ;; Test for specific cases
 (deftest handle-legacy-psa
   (are [name type value min-value max-value]
        (let [m {:name name :type type :value value :minValue min-value :maxValue max-value}]
-         (= {:attribute [(legacy-psa-map->cmr-psa-query m)]}
-          (lp/process-legacy-psa {} (legacy-psa-map->legacy-psa-query m))))
+         (= {:attribute (legacy-psa-maps->cmr-psa-query [m])}
+            (lp/process-legacy-psa {} (legacy-psa-maps->legacy-psa-query [m]))))
        "A,B" "string" nil "B,C" "D,E"
        "A&B" "string" nil "P[C" "Q?r"
        "M[]N" "string" "A&? ;" nil nil))

(ns cmr.search.test.services.legacy-parameters
  (:require [clojure.test :refer :all]
            [cmr.search.services.legacy-parameters :as lp]
            [clojure.test.check.generators :as gen]
            [clojure.test.check.properties :refer [for-all]]
            [ring.util.codec :as rc]
            [cmr.search.services.messages.attribute-messages :as a-msg]

;; Test for mixed parameters
(deftest mixed-paramter-types
  (is (thrown-with-msg? ExceptionInfo (tu/message->regex (a-msg/mixed-legacy-and-cmr-style-parameters-msg))
                        (lp/process-legacy-psa {:attribute ["string,abc,xyz"
                                                            {:name "PDQ"}
                                                            {:type "string"}
                                                            {:value "ABC"}]}
                                               (legacy-psa-maps->legacy-psa-query
                                                 [{:name "PDQ" :type "string" :value "ABC"}])))))



