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

Start with fresh values for nested sagas #23

Closed
madebyherzblut opened this issue Feb 15, 2022 · 0 comments · Fixed by #24
Closed

Start with fresh values for nested sagas #23

madebyherzblut opened this issue Feb 15, 2022 · 0 comments · Fixed by #24
Assignees

Comments

@madebyherzblut
Copy link
Contributor

At the moment the given value for a nested saga already contains the entire path. This leads to a tight coupling of sagas which is not what we want.

This test currently fails

nested_saga_1 =
  Sagax.new()
  |> Sagax.put("c1", assert_value_effect(%{"b" => nil}, {:ok, "c1"}))
  |> Sagax.put("c2", assert_value_effect(%{"c1" => "c1"}, {:ok, "c2"})) # Here the value should only contains the prev comp

nested_saga_2 =
  Sagax.new()
  |> Sagax.put("d", assert_value_effect(nil, {:ok, "d"})) # Since it is the first comp, the value should be nil

saga =
  Sagax.new()
  |> Sagax.put("a", fn -> Log.add(l, "a", {:ok, "a"}) end)
  |> Sagax.put("b", fn -> Log.add(l, "b", nested_saga_1) end)
  |> Sagax.put("f", nested_saga_2)

assert %Sagax{state: :ok, value: value} = Executer.execute(saga)
assert_log l, ["a", "b"]
assert value == %{"a" => "a", "b" => %{"c1" => "c1", "c2" => "c2"}, "f" => %{"d" => "d"}}
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

Successfully merging a pull request may close this issue.

2 participants