diff --git a/test/monger/test/aggregation_framework_test.clj b/test/monger/test/aggregation_framework_test.clj index 74a364f..fe86948 100644 --- a/test/monger/test/aggregation_framework_test.clj +++ b/test/monger/test/aggregation_framework_test.clj @@ -16,12 +16,12 @@ (use-fixtures :each purge-collections) (deftest test-basic-single-stage-$project-aggregation - (let [batch [{ :state "CA" :quantity 1 :price 199.00 } - { :state "NY" :quantity 2 :price 199.00 } - { :state "NY" :quantity 1 :price 299.00 } - { :state "IL" :quantity 2 :price 11.50 } - { :state "CA" :quantity 2 :price 2.95 } - { :state "IL" :quantity 3 :price 5.50 }] + (let [batch [{:state "CA" :quantity 1 :price 199.00} + {:state "NY" :quantity 2 :price 199.00} + {:state "NY" :quantity 1 :price 299.00} + {:state "IL" :quantity 2 :price 11.50 } + {:state "CA" :quantity 2 :price 2.95 } + {:state "IL" :quantity 3 :price 5.50 }] expected #{{:quantity 1 :state "CA"} {:quantity 2 :state "NY"} {:quantity 1 :state "NY"} @@ -36,12 +36,12 @@ (deftest test-basic-projection-with-multiplication - (let [batch [{ :state "CA" :quantity 1 :price 199.00 } - { :state "NY" :quantity 2 :price 199.00 } - { :state "NY" :quantity 1 :price 299.00 } - { :state "IL" :quantity 2 :price 11.50 } - { :state "CA" :quantity 2 :price 2.95 } - { :state "IL" :quantity 3 :price 5.50 }] + (let [batch [{:state "CA" :quantity 1 :price 199.00} + {:state "NY" :quantity 2 :price 199.00} + {:state "NY" :quantity 1 :price 299.00} + {:state "IL" :quantity 2 :price 11.50 } + {:state "CA" :quantity 2 :price 2.95 } + {:state "IL" :quantity 3 :price 5.50 }] expected #{{:_id "NY" :subtotal 398.0} {:_id "NY" :subtotal 299.0} {:_id "IL" :subtotal 23.0} @@ -55,12 +55,12 @@ (deftest test-basic-total-aggregation - (let [batch [{ :state "CA" :quantity 1 :price 199.00 } - { :state "NY" :quantity 2 :price 199.00 } - { :state "NY" :quantity 1 :price 299.00 } - { :state "IL" :quantity 2 :price 11.50 } - { :state "CA" :quantity 2 :price 2.95 } - { :state "IL" :quantity 3 :price 5.50 }] + (let [batch [{:state "CA" :quantity 1 :price 199.00} + {:state "NY" :quantity 2 :price 199.00} + {:state "NY" :quantity 1 :price 299.00} + {:state "IL" :quantity 2 :price 11.50 } + {:state "CA" :quantity 2 :price 2.95 } + {:state "IL" :quantity 3 :price 5.50 }] expected #{{:_id "CA" :total 204.9} {:_id "IL" :total 39.5} {:_id "NY" :total 697.0}}] (mc/insert-batch db coll batch) (let [result (set (mc/aggregate db coll [{$project {:subtotal {$multiply ["$quantity", "$price"]} @@ -72,17 +72,17 @@ (deftest test-$first-aggregation-operator - (let [batch [{ :state "CA" } - { :state "IL"}] + (let [batch [{:state "CA"} + {:state "IL"}] expected "CA"] (mc/insert-batch db coll batch) - (let [result (:state (first (mc/aggregate db coll [{$group { :_id 1 :state {$first "$state"} }}])))] + (let [result (:state (first (mc/aggregate db coll [{$group {:_id 1 :state {$first "$state"}}}])))] (is (= expected result))))) (deftest test-$last-aggregation-operator - (let [batch [{ :state "CA" } - { :state "IL"}] + (let [batch [{:state "CA"} + {:state "IL"}] expected "IL"] (mc/insert-batch db coll batch) - (let [result (:state (first (mc/aggregate db coll [{$group { :_id 1 :state {$last "$state"} }}])))] + (let [result (:state (first (mc/aggregate db coll [{$group {:_id 1 :state {$last "$state"}}}])))] (is (= expected result))))))