Commit 493524f4 authored by Joachim Schunk's avatar Joachim Schunk
Browse files

use blueprint-migration in migration-tests

parent 7b9ba27f
Pipeline #105956 passed with stages
in 2 minutes and 14 seconds
(ns leukipp.components.exercise-types.calculation.migrater-test
(:require
[clojure.data :refer [diff]]
[leukipp.components.exercise-types.calculation.migrate
:refer [exercise-scheme-version migrate-exercise]]
[leukipp.components.exercise-types.calculation.migration
:refer [migrate-backend migrate-blueprint migrate-frontend]]
#?(: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 old-scheme-full
{:title "Zweifache Aufgabe"
......@@ -42,7 +41,7 @@
:correct-points 2
:incorrect-points 0}]}})
(def new-scheme-full
(def new-scheme-full-blueprint
{:title "Zweifache Aufgabe"
:id "20180605T153201-atom54218"
:type :exercise
......@@ -75,10 +74,7 @@
:error-relative 1
:correct-points 2
:incorrect-points 0}]}
:authoring
{:migration-status :current}
:exercise-scheme
{:type "calculation" :version exercise-scheme-version}})
:_schemas {:exercise-calculation "20220124-01-initial-version"}})
(def old-scheme-minimal
{:title "Zweifache Aufgabe"
......@@ -114,7 +110,7 @@
:correct-points 2
:incorrect-points 0}]}})
(def new-scheme-minimal
(def new-scheme-minimal-blueprint
{:title "Zweifache Aufgabe"
:id "20180605T153201-atom54218"
:type :exercise
......@@ -145,27 +141,20 @@
:error-relative 1
:correct-points 2
:incorrect-points 0}]}
:authoring
{:migration-status :current}
:exercise-scheme
{:type "calculation" :version exercise-scheme-version}})
:_schemas {:exercise-calculation "20220124-01-initial-version"}})
(deftest calculation-migrate-1
(testing "checker - multistep-calculation-migrate-1"
(let [differences (diff (migrate-exercise old-scheme-full) new-scheme-full)]
(is (= [nil nil] [(first differences) (second differences)])))))
(deftest calculation-migrate-blueprint-1
(testing "checker - calculation-migrate-blueprint-1"
(is (= (migrate-blueprint old-scheme-full) new-scheme-full-blueprint))))
(deftest calculation-migrate-2
(testing "checker - multistep-calculation-migrate-2"
(let [differences (diff (migrate-exercise new-scheme-full) new-scheme-full)]
(is (= [nil nil] [(first differences) (second differences)])))))
(deftest calculation-migrate-blueprint-2
(testing "checker - calculation-migrate-blueprint-2"
(is (= (migrate-blueprint new-scheme-full-blueprint) new-scheme-full-blueprint))))
(deftest calculation-migrate-3
(testing "checker - multistep-calculation-migrate-3"
(let [differences (diff (migrate-exercise old-scheme-minimal) new-scheme-minimal)]
(is (= [nil nil] [(first differences) (second differences)])))))
(deftest calculation-migrate-blueprint-3
(testing "checker - calculation-migrate-blueprint-3"
(is (= (migrate-blueprint old-scheme-minimal) new-scheme-minimal-blueprint))))
(deftest calculation-migrate-4
(testing "checker - multistep-calculation-migrate-4"
(let [differences (diff (migrate-exercise new-scheme-minimal) new-scheme-minimal)]
(is (= [nil nil] [(first differences) (second differences)])))))
(deftest calculation-migrate-blueprint-4
(testing "checker - calculation-migrate-blueprint-4"
(is (= (migrate-blueprint new-scheme-minimal-blueprint) new-scheme-minimal-blueprint))))
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