From 6a113bf0bb677d0236b25374b0e8815674e38f28 Mon Sep 17 00:00:00 2001 From: Darwin D Wu Date: Mon, 27 May 2024 21:27:35 -0700 Subject: [PATCH] add integration test for invoke --- test/inngest/function/cases/invoke_test.exs | 25 +++++++++++++++++++++ test/support/cases/invoke_fn.ex | 2 +- 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 test/inngest/function/cases/invoke_test.exs diff --git a/test/inngest/function/cases/invoke_test.exs b/test/inngest/function/cases/invoke_test.exs new file mode 100644 index 0000000..3ba4622 --- /dev/null +++ b/test/inngest/function/cases/invoke_test.exs @@ -0,0 +1,25 @@ +defmodule Inngest.Function.Cases.InvokeTest do + use ExUnit.Case, async: true + + alias Inngest.Test.DevServer + import Inngest.Test.Helper + + @default_sleep 5_000 + + @tag :integration + test "should run successfully" do + event_id = send_test_event("test/invoke.caller") + Process.sleep(@default_sleep) + + assert {:ok, + %{ + "data" => [ + %{ + "output" => %{"data" => "INVOKED!"}, + "run_id" => _, + "status" => "Completed" + } + ] + }} = DevServer.run_ids(event_id) + end +end diff --git a/test/support/cases/invoke_fn.ex b/test/support/cases/invoke_fn.ex index 7ccee92..bb496e4 100644 --- a/test/support/cases/invoke_fn.ex +++ b/test/support/cases/invoke_fn.ex @@ -14,7 +14,7 @@ defmodule Inngest.Test.Case.InvokeCallerFn do step.invoke(ctx, "caller", %{ function: Inngest.Test.Case.InvokedFn, data: %{yolo: true}, - timeout: "5m" + timeout: "10s" }) {:ok, res}