               not)))
 
     (testing "Nested string transform"
-      (apply (derive-column-transform {"args" {"code" "row['foo'].toUpperCase()"
-                                               "newColumnType" "text"
-                                               "newColumnTitle" "Derived 4"}}))
+      (apply-transformation (derive-column-transform
+                             {"args" {"code" "row['foo'].toUpperCase()"
+                                      "newColumnType" "text"
+                                      "newColumnTitle" "Derived 4"}}))
       (is (= ["A" "B" nil] (map :d2 (latest-data dataset-id))))
 
-      (apply (derive-column-transform {"args" {"code" "row['Derived 4'].toLowerCase()"
-                                               "newColumnType" "text"
-                                               "newColumnTitle" "Derived 5"}}))
+      (apply-transformation (derive-column-transform
+                             {"args" {"code" "row['Derived 4'].toLowerCase()"
+                                      "newColumnType" "text"
+                                      "newColumnTitle" "Derived 5"}}))
       (is (= ["a" "b" nil] (map :d3 (latest-data dataset-id)))))
 
     (testing "Date transform"
-      (let [[tag _] (apply (derive-column-transform {"args" {"code" "new Date()"
-                                                             "newColumnType" "date"
-                                                             "newColumnTitle" "Derived 5"}
-                                                     "onError" "fail"}))]
+      (let [[tag _] (apply-transformation (derive-column-transform
+                                           {"args" {"code" "new Date()"
+                                                    "newColumnType" "date"
+                                                    "newColumnTitle" "Derived 5"}
+                                            "onError" "fail"}))]
         (is (= tag ::lib/ok))
         (is (every? number? (map :d4 (latest-data dataset-id))))))
 
     (testing "Valid type check"
-      (let [[tag _] (apply (derive-column-transform {"args" {"code" "new Date()"
-                                                             "newColumnType" "number"
-                                                             "newColumnTitle" "Derived 6"}
-                                                     "onError" "fail"}))]
+      (let [[tag _] (apply-transformation (derive-column-transform
+                                           {"args" {"code" "new Date()"
+                                                    "newColumnType" "number"
+                                                    "newColumnTitle" "Derived 6"}
+                                            "onError" "fail"}))]
         (is (= tag ::lib/conflict))))
 
     (testing "Sandboxing java interop"
-      (let [[tag _] (apply (derive-column-transform {"args" {"code" "new java.util.Date()"
-                                                             "newColumnType" "number"
-                                                             "newColumnTitle" "Derived 7"}
-                                                     "onError" "fail"}))]
+      (let [[tag _] (apply-transformation (derive-column-transform
+                                           {"args" {"code" "new java.util.Date()"
+                                                    "newColumnType" "number"
+                                                    "newColumnTitle" "Derived 7"}
+                                            "onError" "fail"}))]
         (is (= tag ::lib/conflict))))
 
     (testing "Sandboxing dangerous js functions"
-      (let [[tag _] (apply (derive-column-transform {"args" {"code" "quit()"
-                                                             "newColumnType" "number"
-                                                             "newColumnTitle" "Derived 7"}
-                                                     "onError" "fail"}))]
+      (let [[tag _] (apply-transformation (derive-column-transform
+                                           {"args" {"code" "quit()"
+                                                    "newColumnType" "number"
+                                                    "newColumnTitle" "Derived 7"}
+                                            "onError" "fail"}))]
         (is (= tag ::lib/conflict))))
 
     (testing "Fail early on syntax error"
-      (let [[tag _] (apply (derive-column-transform {"args" {"code" ")"
-                                                             "newColumnType" "text"
-                                                             "newColumnTitle" "Derived 8"}
-                                                     "onError" "fail"}))]
+      (let [[tag _] (apply-transformation (derive-column-transform
+                                           {"args" {"code" ")"
+                                                    "newColumnType" "text"
+                                                    "newColumnTitle" "Derived 8"}
+                                            "onError" "fail"}))]
         (is (= tag ::lib/bad-request))))
 
     (testing "Fail infinite loop"
-      (let [[tag _] (apply (derive-column-transform {"args" {"code" "while(true) {}"
-                                                             "newColumnType" "text"
-                                                             "newColumnTitle" "Derived 9"}
-                                                     "onError" "fail"}))]
+      (let [[tag _] (apply-transformation (derive-column-transform
+                                           {"args" {"code" "while(true) {}"
+                                                    "newColumnType" "text"
+                                                    "newColumnTitle" "Derived 9"}
+                                            "onError" "fail"}))]
         (is (= tag ::lib/bad-request))))
 
 
     (testing "Disallow anonymous functions"
-      (let [[tag _] (apply (derive-column-transform {"args" {"code" "(function() {})()"
-                                                             "newColumnType" "text"
-                                                             "newColumnTitle" "Derived 10"}
-                                                     "onError" "fail"}))]
+      (let [[tag _] (apply-transformation (derive-column-transform
+                                           {"args" {"code" "(function() {})()"
+                                                    "newColumnType" "text"
+                                                    "newColumnTitle" "Derived 10"}
+                                            "onError" "fail"}))]
         (is (= tag ::lib/bad-request)))
 
-      (let [[tag _] (apply (derive-column-transform {"args" {"code" "(() => 'foo')()"
-                                                             "newColumnType" "text"
-                                                             "newColumnTitle" "Derived 11"}
-                                                     "onError" "fail"}))]
+      (let [[tag _] (apply-transformation (derive-column-transform
+                                           {"args" {"code" "(() => 'foo')()"
+                                                    "newColumnType" "text"
+                                                    "newColumnTitle" "Derived 11"}
+                                            "onError" "fail"}))]
         (is (= tag ::lib/bad-request))))))
 
 
 (deftest ^:functional delete-column-test
   (let [dataset-id (import-file "dates.csv" {:has-column-headers? true})
-        apply (partial tf/apply test-conn dataset-id)]
-    (let [[tag _] (apply {:type :transformation
-                          :transformation {"op" "core/delete-column"
-                                           "args" {"columnName" "c2"}
-                                           "onError" "fail"}})]
+        apply-transformation (partial tf/apply test-conn dataset-id)]
+    (let [[tag _] (apply-transformation {:type :transformation
+                                         :transformation {"op" "core/delete-column"
+                                                          "args" {"columnName" "c2"}
+                                                          "onError" "fail"}})]
       (is (= ::lib/ok tag))
       (let [{:keys [columns transformations]} (latest-dataset-version-by-dataset-id test-conn
                                                                                     {:dataset-id dataset-id})]


(deftest ^:functional combine-transformation-test
  (let [dataset-id (import-file "name.csv" {:has-column-headers? true})
        apply (partial tf/apply test-conn dataset-id)]
    (let [[tag _] (apply {:type :transformation
                             :transformation {"op" "core/combine"
                                              "args" {"columnNames" ["c1" "c2"]
                                                      "newColumnTitle" "full name"
                                                      "separator" " "}
                                              "onError" "fail"}})]
      (is (= ::lib/ok tag))
      (let [table-name (:table-name
                        (latest-dataset-version-by-dataset-id test-conn

  (let [dataset-id (import-file "GDP.csv" {:dataset-name "GDP Undo Test"})
        {previous-table-name :table-name} (latest-dataset-version-by-dataset-id test-conn
                                                                                {:dataset-id dataset-id})
        apply-transformation (partial tf/apply test-conn dataset-id)]
    (is (= ::lib/ok (first (apply-transformation {:type :undo}))))
    (let [[tag _] (do (apply-transformation {:type :transformation
                                             :transformation {"op" "core/to-lowercase"
                                                              "args" {"columnName" "c1"}
                                                              "onError" "fail"}})
                      (apply-transformation {:type :transformation
                                             :transformation {"op" "core/change-datatype"
                                                              "args" {"columnName" "c5"
                                                                      "newType" "number"
                                                                      "defaultValue" 0}
                                                              "onError" "default-value"}})
                      (apply-transformation {:type :undo}))]
      (is (= ::lib/ok tag))
      (is (not (:exists (table-exists test-conn {:table-name previous-table-name}))))
      (is (= (:columns (dataset-version-by-dataset-id test-conn
