Skip to content

Commit

Permalink
Add loop test case
Browse files Browse the repository at this point in the history
  • Loading branch information
darwin67 committed Dec 3, 2023
1 parent 2a64cbc commit ce7bcc8
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions test/support/cases/loop_fn.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
defmodule Inngest.Test.Case.LoopFn do
@moduledoc false

use Inngest.Function

@func %FnOpts{id: "loop-fn", name: "Loop Function"}
@trigger %Trigger{event: "test/plug.loop"}

@impl true
def exec(ctx, %{step: step} = _args) do
sum =
Enum.map(1..5, fn n ->
step.run(ctx, "multi", fn -> n * 2 end)
end)
|> Enum.sum()

{:ok, sum}
end
end

0 comments on commit ce7bcc8

Please sign in to comment.