Skip to content

Commit

Permalink
Fix core tests with rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
seb231 committed Aug 21, 2019
1 parent 2a35d13 commit 2cb844a
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions test/cic/core_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -25,27 +25,28 @@

(deftest episodes-test
(testing "remove invalid records"
(is (= 5 (count (episodes data))))))
(is (= 6 (count (episodes data))))))


(deftest assoc-period-id-test
(testing "id 120 consists of 3 periods"
(let [child (filter #(= (:child-id %) 120) (episodes data))
result (assoc-period-id child)]
(is (= 3 (count (distinct result))))
(is (= '("120-0" "120-1" "120-2") (map :period-id result))))))
(is (= 4 (count (distinct result))))
(is (= '("120-0" "120-1" "120-2") (distinct (map :period-id result)))))))


(deftest summarise-periods-at-test
(deftest summarise-periods-test
(let [result (->> (episodes data)
(assoc-period-id)
(group-by :period-id)
(vals)
(map #(summarise-periods-at % projection-start)))]
(testing "a single open episode"
(is (= 1 (count (filter #(= true (:open? %)) result)))))
(map (comp #(assoc-open-at % projection-start)
summarise-periods)))]
(testing "remove open episodes"
(is (= (- (count (episodes data)) 1) (count result))))
(testing "duration in care calculated"
(is (= 1550 (:duration (first (filter #(= (:period-id %) "120-0") result))))))
(is (= 8 (:duration (first (filter #(= (:period-id %) "120-0") result))))))
(testing "multiple episodes in a period"
(is (= [{:offset 0, :placement :K1} {:offset 8, :placement :K2}]
(->> result
Expand Down

0 comments on commit 2cb844a

Please sign in to comment.