Commit 67afe576 authored by Joachim Schunk's avatar Joachim Schunk
Browse files

use new answer-migratin in test

parent e6aad1af
Pipeline #105984 passed with stages
in 2 minutes and 11 seconds
(ns leukipp.components.exercise-types.calculation.answer-migrater-test
(:require
[clojure.data :refer [diff]]
[leukipp.components.exercise-types.calculation.migrate-answer
:refer [answer-scheme-version migrate-answer]]
[leukipp.components.exercise-types.calculation.migration :refer [migrate-answer]]
#?(:cljs
[cljs.test :refer-macros [deftest testing is]]
:clj
[clojure.test :refer [deftest is testing]])))
[cljs.test :refer-macros [deftest testing is]]
:clj
[clojure.test :refer [deftest is testing]])))
(def calc-ids #{"e1" "e2" "e3"})
(def exercise {:core {:type :calculation
:calculations [{:id "e1"}
{:id "e2"}
{:id "e3"}]}})
(def old-scheme {"e1" {:number "3"
:order-of-magnitude "-3"
......@@ -28,15 +29,12 @@
:units []}
"e3" {:number {:significand nil
:order-of-magnitude "0"}}}
:answer-scheme {:type "calculation"
:version answer-scheme-version}})
:_schemas {:exercise-calculation-answer "20220124-01-initial-version"}})
(deftest multistep-calculation-answer-migrate-1
(testing "checker - multistep-calculation-migrate-1"
(let [differences (diff (migrate-answer calc-ids old-scheme) new-scheme)]
(is (= [nil nil] [(first differences) (second differences)])))))
(deftest calculation-answer-migrate-1
(testing "checker - calculation-answer-migrate-1"
(is (= new-scheme (migrate-answer old-scheme exercise)))))
(deftest multistep-calculation-answer-migrate-2
(testing "checker - multistep-calculation-migrate-2"
(let [differences (diff (migrate-answer calc-ids new-scheme) new-scheme)]
(is (= [nil nil] [(first differences) (second differences)])))))
(deftest calculation-answer-migrate-2
(testing "checker - calculation-answer-migrate-2"
(is (= new-scheme (migrate-answer new-scheme exercise)))))
Supports Markdown
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