Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generalize test function output #18

Closed
jstokes opened this issue Jun 18, 2018 · 0 comments
Closed

Generalize test function output #18

jstokes opened this issue Jun 18, 2018 · 0 comments

Comments

@jstokes
Copy link
Member

jstokes commented Jun 18, 2018

Instead of tests being responsible for returning an (un)modified context map, we can make this a bit more explicit. If our create-foo function returns a test step, we could have a few options for modifying the context:

(defn create-foo
  [params]
  #::step
  {:tenant/id (step/lookup :tenant/id)
   :test
   (fn [step] ; inputs or step?
     ...
     foo-id)
   ;; option 0
   ;; nothing
   ;; option 1
   :output :foo/id
   ;; option 2
   :output (fn [ctx foo-id] (i-dont-even-know ctx :foo/id foo-id))
   })

Option 0 would be no ::step/output, meaning return the context unmodified.
Option 1 would assoc :foo/id into the context with the value foo-id.
Option 2 gives the most flexibility as a function of the input context and the returned value of the test step foo-id.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant