 (deftest test-state-transitioning
   (let [transitions [(create-transition :foo :bar "foo->bar")
                      (create-transition :bar :baz "bar->baz")]
-        job (create! *jobstore* (create-job nil transitions :foo))]
+        job (create! *jobstore* (create-job nil nil transitions :foo))]
 
     (testing "does not change state when event does not match transition"
       (let [new-job (emit! *jobstore* (mk-test-event "bar->baz" job))]


(deftest test-local-jobstore
  (testing "Assigns id to job on create"
    (let [job (create-job nil [] nil)
          saved-job (create! *jobstore* job)]
      (is (not (nil? (:id saved-job))))))

  (testing "Can retrieve saved job"
    (let [saved-job (create! *jobstore* (create-job nil [] nil))
          retrieved-job (find-by-id *jobstore* (:id saved-job))]
      (is (= saved-job retrieved-job))))

  (testing "Updates existing job with function"
    (let [saved-job (create! *jobstore* (create-job nil [] nil))
          updated-job (update! *jobstore* saved-job
                                              #(update-in % [:states] conj :foo))
          retrieved-job (find-by-id *jobstore* (:id saved-job))]


(deftest test-creating-jobs-from-workflows
  (testing "Creates job using workflow as blueprint"
    (let [workflow (create! *workflowstore* (create-workflow nil nil [] :a-state))
          job (Workflow->Job workflow)]
      (is (nil? (:id job)))
      (is (= :a-state (:current-state job))))))
