-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
44 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
defmodule Inngest.Test.Case.NoStepFn do | ||
@moduledoc false | ||
|
||
use Inngest.Function | ||
alias Inngest.{FnOpts, Trigger} | ||
|
||
@func %FnOpts{id: "no-step-fn", name: "No Step Function"} | ||
@trigger %Trigger{event: "test/no-step"} | ||
|
||
@impl true | ||
def exec(_, _args) do | ||
{:ok, "hello world"} | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
defmodule Inngest.Test.Case.StepFn do | ||
@moduledoc false | ||
|
||
use Inngest.Function | ||
alias Inngest.{FnOpts, Trigger} | ||
|
||
@func %FnOpts{id: "step-fn", name: "Step Function"} | ||
@trigger %Trigger{event: "test/step"} | ||
|
||
@count 0 | ||
|
||
@impl true | ||
def exec(ctx, %{step: step} = _args) do | ||
step1 = step.run(ctx, "step1", fn -> @count + 1 end) | ||
tmp = step1 + 1 | ||
step2 = step.run(ctx, "step2", fn -> tmp + 1 end) | ||
tmp2 = step2 + 1 | ||
|
||
{:ok, tmp2 + 1} | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,9 @@ | ||
defmodule Inngest.Dev.Router do | ||
defmodule Inngest.Test.PlugRouter do | ||
Check warning on line 1 in test/support/router/plug.ex GitHub Actions / Linter
|
||
use Plug.Router | ||
use Inngest.Router, :plug | ||
alias Inngest.Dev.{EventFn, CronFn} | ||
|
||
require Logger | ||
Logger.configure(level: System.get_env("DEV_LOG_LEVEL", :debug)) | ||
Logger.configure(level: System.get_env("DEV_LOG_LEVEL", "debug")) | ||
|
||
plug(Plug.Logger, log: :debug) | ||
|
||
|
@@ -26,15 +25,17 @@ defmodule Inngest.Dev.Router do | |
|> send_resp(200, data) | ||
end | ||
|
||
inngest("/api/inngest", path: System.get_env("INNGEST_FN_PATH", "dev/**")) | ||
inngest("/api/inngest", path: "test/support/cases/*") | ||
|
||
match _ do | ||
send_resp(conn, 404, "oops\n") | ||
end | ||
|
||
def start_server() do | ||
Task.async(fn -> | ||
webserver = {Plug.Cowboy, plug: Inngest.Dev.Router, scheme: :http, options: [port: 4000]} | ||
webserver = | ||
{Plug.Cowboy, plug: Inngest.Test.PlugRouter, scheme: :http, options: [port: 4000]} | ||
|
||
{:ok, _} = Supervisor.start_link([webserver], strategy: :one_for_one) | ||
Logger.info("Server listening on 127.0.0.1:4000") | ||
|
||
|